0
这应该很容易,但我无法找到一个解决方案。在RelativeLayout中有三个ImageView。这些ImageViews将代表三个按钮(我尝试使用的ImageButton还有,同样的问题在那里)。ImageView的源不能扩展
事情是,三种源,bluered,绿色和blueyellow是一些尺寸的* .png文件(在这种情况下比按钮/ ImageViews尺寸更大)。我希望这些资源能够扩展到融入ImageViews和使用buttonsleftRightMenu的尺寸。来源是二次图像,所以这应该很容易。我哪里出错了?
XML文件:
<?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>
我没有足够的时间来写一个完整的答案,但考虑到有** weightSum =“3” **,然后设置各自的ImageView有** layout_weight =把它变成一个**的LinearLayout ** “3” ** – bbedward 2012-03-06 21:07:38
将这种方法使用更少的系统资源,还是有它的任何其他好处? – 2012-03-06 21:10:00