1

投稿したボタンのUIを揃える必要があります。Buttonまたはの使い方がわかりませんImageButton。ボタン内の画像とテキストを揃えるにはどうすればよいですか?

<ImageButton
                    android:id="@+id/btnGroupDelete"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="5dip"
                    android:layout_weight="1"
                    android:background="@drawable/list_buttonselector"
                    android:contentDescription="@string/delete"
                    android:src="@drawable/ox_icn_delete" />
4

3 に答える 3

2

ドローアブルに画像を保存してから、xml の [画像] ボタンを使用します

<ImageButton
android:id="@+id/ImageButton01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/button_image_name" />

ボタンの状態の変更 (押された、フォーカスされた、デフォルト) については、以下を参照してください。

http://developer.android.com/reference/android/widget/ImageButton.html

于 2012-05-05T07:29:11.687 に答える
1
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/image"
android:layout_gravity="center_horizontal"
android:paddingLeft="10dip"
android:text="@string/btntext" />
于 2012-05-05T09:09:39.023 に答える
1
        <Button
        android:id="@+id/button1"
        android:gravity="right"  <----------
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />
于 2012-05-05T07:32:32.793 に答える