Android 使按钮起作用
如何在Android的背景图像上添加按钮 我已经添加了背景,现在我想添加一个按钮,使其在背景中工作。我曾尝试添加多个按钮,但都不起作用,我不确定是布局还是其他原因 这就是我到目前为止所做的:Android 使按钮起作用,android,android-button,Android,Android Button,如何在Android的背景图像上添加按钮 我已经添加了背景,现在我想添加一个按钮,使其在背景中工作。我曾尝试添加多个按钮,但都不起作用,我不确定是布局还是其他原因 这就是我到目前为止所做的: <Button style="?android:attr/buttonStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:tex
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="back"
android:id="@+id/button2"
android:layout_alignTop="@+id/button"
android:background="@drawable/scan1"
android:layout_centerHorizontal="true"
android:layout_alignParentStart="false"
android:layout_alignParentLeft="false" />
我编辑了代码,所以“scan1”可绘制文件显示为红色。透明按钮
android:background="@null"
或
使用库创建具有透明背景的按钮。设置fb\u defaultColor
参数如下:
fancy:fb_defaultColor="@android:color/transparent"
使用此库,您不会因单击按钮而失去连锁反应
android:background="?android:attr/selectableItemBackground"
将此添加到按钮
xml
。。希望对您有所帮助您也可以在xml中使用:
android:background="@null"
或在代码中:
button.setBackgroundColor(Color.TRANSPARENT);
请看一看。你给它一个背景图像,你怎么期望它是透明的?!!Muhammed,我得到了这张图片,上面有应用程序上的按钮,我把这张图片作为我的背景图片。现在我想把按钮放在那些地方,然后使它们透明,这样它们就与背景融为一体了,我不知道你是否明白我的意思。
button.setBackgroundColor(Color.TRANSPARENT);