设置一个按钮为透明,

(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);即可

相关文章:

  • 2021-09-27
  • 2022-01-05
  • 2021-08-07
  • 2021-11-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-19
  • 2021-07-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-02
  • 2022-01-16
相关资源
相似解决方案