簡體   English   中英

我在 Android Studio 上的 Image View Size 有問題

[英]I have a problem with Image View Size on Android Studio

在此處輸入圖片說明

我嘗試制作 Droid Cafe 應用程序,並將此代碼輸入到我的 XML 文件中

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/content_main" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context=".MainActivity" tools:showIn="@layout/activity_main">

<TextView android:id="@+id/textintro" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/intro_text" android:textSize="@dimen/text_heading" android:padding="@dimen/padding_regular" />

<TextView android:id="@+id/choose_dessert" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/textintro" android:padding="@dimen/padding_regular" android:text="@string/choose_a_dessert"/>

<ImageView android:id="@+id/donut" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/choose_dessert" android:contentDescription="@string/donuts" android:onClick="showDonutOrder" android:padding="@dimen/padding_regular" android:src="@drawable/donut_circle"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="@dimen/padding_wide" android:layout_below="@id/choose_dessert" android:layout_toRightOf="@id/donut" android:text="@string/donuts" android:layout_toEndOf="@id/donut"/>

<ImageView android:id="@+id/ice_cream" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/donut" android:contentDescription="@string/ice_cream_sandwiches" android:onClick="showIceCreamOrder" android:padding="@dimen/padding_regular" android:src="@drawable/icecream_circle"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/donut" android:layout_toRightOf="@id/ice_cream" android:padding="@dimen/padding_wide" android:text="@string/ice_cream_sandwiches" android:layout_toEndOf="@id/ice_cream"/>

<ImageView android:id="@+id/froyo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/ice_cream" android:padding="@dimen/padding_regular" android:contentDescription="@string/froyo" 
android:src="@drawable/froyo_circle" android:onClick="showFroyoOrder"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/ice_cream" android:layout_toRightOf="@id/froyo" android:padding="@dimen/padding_wide" android:text="@string/froyo" android:layout_toEndOf="@id/froyo"/>
</RelativeLayout>

但是我的尺寸有問題,甜甜圈和冰淇淋三明治的尺寸相同,但最后一個,FroYo 是如此不同,它太小了。

我怎樣才能解決這個問題?

您存儲的圖像文件可能具有不同的大小。 使用相同的大小/dp 再次上傳圖像或為圖像視圖的 layout_width 和 layout_height 設置修復 dp(如 100dp)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM