您的位置:首页 > 其它

设置背景为透明

2014-07-01 16:51 176 查看
三种设置透明的方法,个人比较常用1和3

1、xml中使用Android预设值

android:background="@android:color/transparent"

例如,

<Button android:background="@android:color/transparent"

android:text="@+id/Button01"

android:layout_width="wrap_content"

android:layout_height="wrap_content" />

2、xml中使用RGB

半透明<Button android:background="#e0000000" />

透明<Button android:background="#00000000" />

3、java类中设置

View v = findViewById(R.id.content);

v.getBackground().setAlpha(100); //0~255透明度值
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: