我需要为我的按钮设置透明背景,但只有背景,不是全部按钮。 我已经试过:按钮的透明背景
android:background=""
android:background="null"
和背景上的透明的改变,但我有一个错误:
Error: String types not allowed (at 'background' with value '').
我需要为我的按钮设置透明背景,但只有背景,不是全部按钮。 我已经试过:按钮的透明背景
android:background=""
android:background="null"
和背景上的透明的改变,但我有一个错误:
Error: String types not allowed (at 'background' with value '').
类型此属性值应该是颜色,所以使用属性的buildin为透明背景用色值:
与透明背景android:background="@android:color/transparent"
材料波纹效应some Info
android:background="?android:attr/selectableItemBackground"
例如
<Button android:layout_marginTop="15dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="?android:attr/selectableItemBackground" android:text="@string/add" android:layout_marginBottom="10dp" android:textSize="18sp" android:textStyle="bold" android:textColor="@color/fab_dark" android:id="@+id/btnOkFood" android:layout_gravity="right" />
随着程序兼容性V7,这是支持API => 11,这比一个透明背景好一点,只是因为给触摸的反馈。
您可以使用android:background="@null"
'机器人:背景= “#AARRGGBB”'其中AA是您的alpha通道。将此设置为“00”为透明。 –
马特克拉克+1,android:background =“#00000000” – dex