Android设置透明、半透明效果
16lz
2021-01-23
设置透明效果 大概有三种:
1、用android系统的透明效果
Java代码
android:background="@android:color/transparent"
例如 设置按钮
Java代码
<Button android:background="@android:color/transparent"
android:text="@+id/Button01"
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff" />
2、用ARGB来控制 Java代码
半透明<Button android:background="#e0000000" />
透明<Button android:background="#00000000" /> 3、设置alpha Java代码
View v = findViewById(R.id.content);//找到你要设透明背景的layout 的id
v.getBackground().setAlpha(100);//0~255透明度值
1、用android系统的透明效果
Java代码
android:background="@android:color/transparent"
例如 设置按钮
Java代码
<Button android:background="@android:color/transparent"
android:text="@+id/Button01"
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff" />
2、用ARGB来控制 Java代码
半透明<Button android:background="#e0000000" />
透明<Button android:background="#00000000" /> 3、设置alpha Java代码
View v = findViewById(R.id.content);//找到你要设透明背景的layout 的id
v.getBackground().setAlpha(100);//0~255透明度值
更多相关文章
- TextView 实现跑马灯效果
- 转:善用Android预定义样式来为我们的布局设置效果,大大节约代码量
- android实现图片平铺效果&WebView多点触控实现缩放
- Android基于TextView实现跑马灯效果
- 在EeePC上运行Android!(转)(也是代码下载配置编译的流程!)
- android上dialog横屏下实现全屏效果
- Marquee 跑马效果
- -Android各版本系统源代码下载
- 设置TextView文字居中,代码实现android:layout_gravity