android设置view透明度的效果

推荐textView.setBackgroundColor(Color.TRANSPARENT);
 
 


Xml代码 


  1. android:background="#ff6495ED"

前两位表示透明度,后面依次为RGB,透明度从0到255,0为完全透明,255为不透明。 

第二种方法:在java文件中获取该控件的Drawable,设置透明度 


Java代码 


  1. convertView.getBackground().setAlpha(80);

convertView为视图控件,80表示透明度。 

第三种,直接设置透明度 

setAlpha(80)

相关文章:

  • 2021-12-04
  • 2022-12-23
  • 2021-11-20
  • 2021-10-10
  • 2021-12-21
  • 2021-10-22
  • 2022-01-13
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-20
  • 2021-11-29
  • 2021-12-04
  • 2021-05-16
  • 2021-11-19
  • 2022-12-23
相关资源
相似解决方案