Android ImageView源将无法缩放
这应该很容易,但我找不到解决办法。我有三个相对论视图。这些ImageView将表示三个按钮(我也尝试过使用ImageButton,同样的问题) 事实上,这三个源,蓝红色、绿色和蓝黄色是一些大小的*.png文件(在本例中大于按钮/图像视图大小)。我希望这些源可以缩放以适应ImageView,并使用按钮的维度LeftRightMenu。源是二次图像,所以这应该很容易。我哪里出错了 xml文件:Android ImageView源将无法缩放,android,scale,android-imageview,Android,Scale,Android Imageview,这应该很容易,但我找不到解决办法。我有三个相对论视图。这些ImageView将表示三个按钮(我也尝试过使用ImageButton,同样的问题) 事实上,这三个源,蓝红色、绿色和蓝黄色是一些大小的*.png文件(在本例中大于按钮/图像视图大小)。我希望这些源可以缩放以适应ImageView,并使用按钮的维度LeftRightMenu。源是二次图像,所以这应该很容易。我哪里出错了 xml文件: <?xml version="1.0" encoding="utf-8"?> <Rel
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@integer/leftMenuID"
>
<ImageView
android:layout_width="@dimen/buttonsLeftRightMenu"
android:layout_height="@dimen/buttonsLeftRightMenu"
android:src="@drawable/bluered"
android:id="@integer/leftMenuButton1ID"
android:clickable="true"
android:contentDescription="@string/leftMenuButton1ContentDescription"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
/>
<ImageView
android:layout_width="@dimen/buttonsLeftRightMenu"
android:layout_height="@dimen/buttonsLeftRightMenu"
android:id="@integer/leftMenuButton2ID"
android:clickable="true"
android:src="@drawable/green"
android:background="@color/transparent"
android:contentDescription="@string/leftMenuButton2ContentDescription"
android:layout_below="@integer/leftMenuButton1ID"
android:scaleType="fitCenter"
/>
<ImageView
android:layout_width="@dimen/buttonsLeftRightMenu"
android:layout_height="@dimen/buttonsLeftRightMenu"
android:id="@integer/leftMenuButton3ID"
android:clickable="true"
android:src="@drawable/blueyellow"
android:background="@color/transparent"
android:contentDescription="@string/leftMenuButton3ContentDescription"
android:layout_below="@integer/leftMenuButton2ID"
android:scaleType="fitCenter"
/>
</RelativeLayout>
这只是一个愚蠢的错误。代码工作得很好,只要记住对Currxt XML文件进行膨胀。我没有足够的时间写完整的答案,但是考虑把它转换成一个线性布局,它的权重是“3”,然后将每个图像视图设置成一个LayOutuSug=“3”,这样的方法会使用更少的系统资源,还是有其他的好处?