34

アプリ ボタンの後ろに灰色の境界線があります。これを削除するにはどうすればよいですか?

私は次のように定義しましたImageButton

<ImageButton
    android:id="@+id/btn_photo_lib"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:onClick="startPhotoLibAction"
    android:src="@drawable/library_blau_2" />
4

6 に答える 6

91

使用する必要がありますstyle="?android:attr/borderlessButtonStyle"

<ImageButton
    android:id="@+id/btn_photo_lib"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:onClick="startPhotoLibAction"
    android:src="@drawable/library_blau_2"
    style="?android:attr/borderlessButtonStyle"/>
于 2014-12-15T15:59:01.263 に答える
11

これを試して :

<ImageButton
        android:id="@+id/btn_photo_lib"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="startPhotoLibAction"
        android:background="@android:color/transparent"
        android:src="@drawable/library_blau_2" />
于 2013-01-18T09:12:46.583 に答える
10

シンプルで簡単な方法は

android:background="?android:attr/selectableItemBackground"
于 2015-09-19T08:09:24.923 に答える
3

以下のように、イメージビューの背景を透明に変更するだけです。

<ImageButton
    android:id="@+id/btn_photo_lib"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@android:color/transparent" <----- Set background.
    android:onClick="startPhotoLibAction"
    android:src="@drawable/library_blau_2" />

または背景のみを設定でき、透明色を適用する必要はありません。

<ImageButton
    android:id="@+id/btn_photo_lib"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/download" <--- set only the background
    android:onClick="startPhotoLibAction"
 />
于 2013-01-18T09:23:25.173 に答える