Android设置透明、半透明等效果
2016-03-31 17:36
489 查看
设置透明效果 大概有三种
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透明度值
相关文章推荐
- android adb端口被占用解决方案
- android launchmode 使用场景
- android: 使用通知
- 深入理解Android之Gradle
- Android Glide Google 推荐加载图片框架(加载图片详解篇)
- 关于Android使用 share绘制虚线却在手机上显示实线问题
- Android蓝牙开发详解
- Android AlarmManager实现不间断轮询服务
- Android中制作进度框和环形进度条的简单实例分享
- Android双进程守护
- Android中横竖屏切换时,onConfigurationChanged方法不被调用
- [置顶] Android Studio 运行、编译卡死的解决办法
- Android实例-全屏显示程序(XE10+小米2)(无图)
- 石家庄android培训哪家实力强、就业率高?
- android项目中使用开源数据库litepal
- Android SDK目录及版本号区别
- Android布局中的setOnClickListener没有作用
- Android应用获取包名等信息
- jcifs 在android下无法获得工作组信息的原因
- Android ServiceConnection的应用