我正在尝试在我的图像按钮上设置前景图像。这样,按钮灰色背景可见,图像出现在前景中。
如果有任何想法,我将不胜感激。
谢谢
最佳答案
如果您想在设置前景图像时移除灰色背景,请设置一个空的背景图像。 或者只需将背景图像设置为按钮而不是设置前景图像。 我希望这能帮到您。
用代码编辑
<ImageButton android:text="Button" android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon"/>
<ImageButton android:text="Button" android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/icon"/>
关于android-widget - 在Android中的图像按钮上设置前景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7319292/