你必须使用
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"/>
试试这个:
<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" />
简单易行的方法是
android:background="?android:attr/selectableItemBackground"
我发现这个效果很好:
android:背景=“@null”
只需将图像视图的背景更改为透明,如下所示:
<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" />
OR 您可以只设置背景,不需要应用透明色。
<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"
/>
试试这个 样式 =“?android:attr / borderlessButtonStyle” 在您的按钮选项卡中
你可以试试这个简单的
android:background=""