さまざまなコンテンツを介してプログラムで幅を変更できるボタンのスタイルを設定しています。次のように、デザイナーから png ファイルを取得しました。
[Left Border] [Background (just a strip with the gradient)] [Right Border]
ボタンのプロパティを次のように割り当てても問題ないと思いました。
Background: Background.png
Drawable left: LeftBorder.png
Drawable right: RightBorder.png
しかし、それはそのようであってはなりません ;) 現在、Background.png は Drawable Left が始まるところから始まり、Drawable Right の終わりで終わります。この場合、これらの Drawable Properties を使用するのは正しい方法ではありませんか?
コードは次のとおりです。
<Button
android:text="@+id/Button01"
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/top_loaction_left"
android:drawableRight="@drawable/top_loaction_right"
android:background="@drawable/top_loaction_bg"></Button>
..