简体   繁体   English

我在 Android Studio 上的 Image View Size 有问题

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

在此处输入图片说明

I try to make Droid Cafe app, and I input this code to my XML file我尝试制作 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>

But I got a problem with the Size, the Donut and the Ice Scream Sandwich have the same size, but the last one, the FroYo is so different, it's too small.但是我的尺寸有问题,甜甜圈和冰淇淋三明治的尺寸相同,但最后一个,FroYo 是如此不同,它太小了。

How can I fix this?我怎样才能解决这个问题?

Your stored image files probably have different sizes.您存储的图像文件可能具有不同的大小。 upload the image again with the same size/dp or set fix dp (like 100dp) for layout_width and layout_height of the imageview.使用相同的大小/dp 再次上传图像或为图像视图的 layout_width 和 layout_height 设置修复 dp(如 100dp)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM