ビューで使用するための簡単な9パッチPNG写真を作成しようとしていImageButton
ますが、正しくスケーリングされていません。たとえば、私が使用している9patchPNG画像は次のとおりです。
ただし、これはスケーリング方法です。
これはボタンの私のXMLです:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/add_challenge1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/lockedbutton1"
android:onClick="add1" />
<ImageButton
android:id="@+id/add_challenge2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/lockedbutton1"
android:onClick="add2" />
<ImageButton
android:id="@+id/add_challenge3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/lockedbutton1"
android:onClick="add3" />
<ImageButton
android:id="@+id/add_challenge4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/lockedbutton1"
android:onClick="add4" />
<ImageButton
android:id="@+id/add_challenge5"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/lockedbutton1"
android:onClick="add5" />
</LinearLayout>
均等に引き伸ばされてロックを中央に維持するのではなく、画像がコンテンツ(ロック)で左よりもはるかに右に拡大縮小されている理由はよくわかりません。なぜこれが起こっているのかについてのアイデアはありますか?たくさんの人が助けを提供してくれてありがとう。