私はこれを試していないし、あなたが話しているボタンを見たことがない。しかし、プロセスは似たようなものでなければなりません。
まず、ドロアブル(実際の背景画像)を作成します。赤い背景と透明なものの1つ。あなたの描画可能なXMLは次のようなものになります。
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/btn_bg_red"/>
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/btn_bg_red"/>
<item android:state_focused="true" android:drawable="@drawable/btn_bg_pressed"/>
<item android:state_focused="false" android:state_pressed="false" android:drawable="@android:color/transparent"/>
</selector>
を次に、あなたのボタン自体は次のように宣言することができます。
<Button android:id="@+id/droid_x_btn"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Droid Does"
android:drawableTop="@drawable/btn_icon" <!-- this is for the icon on top -->
android:background="@drawable/ic_droid_x_button" <!-- The name of the above file without extension -->
android:textColor="@color/white" />
は、この情報がお役に立てば幸い!
ちょっと、それは私が持っているものですが、あなたの方がよりエレガントです。テキストの後ろの黒いバーが調整できなくても、これは解決策として機能すると思います。ありがとうございます。 :) – Joshua