Android设置按钮为透明

设置一个按钮为透明,

(1)修改配置文件
<Button
android:id="@+id/btnAppMore"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="详细信息>>"
    android:layout_alignParentRight="true"
    android:layout_marginLeft="150dp"    
   android:background="@android:color/transparent"
    />
设置完透明按钮以后,发现按钮不见了……
(2)注意,按钮默认颜色同手机背景色(黑色)一样,按钮的文字默认也为黑色,这里,我们可以通过activity的oncreate()中设置一下按钮的字体颜色:
btn=(Button)findViewById(R.id.btnAppMore);
btn.setTextColor(Color.WHITE);
其实,透明也可以通过Java完成,嘎嘎,btn.setBackgroundColor(Color.TRANSPARENT);即可
原文地址:https://www.cnblogs.com/zl1991/p/5266182.html