0
これは簡単ですが、解決策が見つかりませんでした。私は、RelativeLayout内に3つのImageViewを持っています。これらのImageViewsは3つのボタンを表しています(ImageButtonも同様の問題があります)。ImageViewのソースは縮尺されません
3つのソース、bluered、green、blueyellowは、いくつかのサイズの* .pngファイルです(この場合、ボタン/ ImageViewsサイズよりも大きくなります)。これらのソースをImageViewsに合わせて拡大し、buttonsleftRightMenuのディメンションを使用します。ソースは2次画像ですので、これは簡単です。どこが間違っていますか?
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" **を使って** LinearLayout **に変換し、各ImageViewを** layout_weight = "3" ** – bbedward
このようなアプローチではシステムリソースが少なくて済みますか、それとも他の利点がありますか? –