我需要爲我的按鈕設置透明背景,但只有背景,不是全部按鈕。 我已經試過:按鈕的透明背景
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