android 设置透明效果
2016-05-31 14:46
309 查看
转载自:http://blog.csdn.net/sy_shu/article/details/6993350
设置透明效果 大概有三种
1、用android系统的透明效果
Java代码
android:background="@android:color/transparent"
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" />
< 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" />
半透明<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"
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" />
< 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" />
半透明<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 支持SVG VectorDrawable
- Android RecyclerView 使用完全解析 体验艺术般的控件
- Android检查应用权限是否被禁用,解决权限被禁用时程序崩溃
- Android Dev Intro - Stencil Test
- Android Studio文件名颜色代表的具体的意思
- Android-在应用中使用拖拽教程
- Android 平滑图片加载和缓存库 Glide 使用详解
- Android加载图片你必须知道的技巧
- Android性能优化——工具篇
- Google Android开发者文档系列-与其他应用程序交互之使用户跳转到其它应用程序
- Android线程池使用终结版
- android 游戏 实战打飞机游戏 实现无限循环的背景图(2)
- Java4Android第4课:java的封装性
- Android自定义控件LinearLayout实例讲解
- android 创建文件夹和文件
- Android 自定义View (一)
- 关于Android新浪客户端SDK,如何用…
- 关于静态常量造成的那些见鬼的情况我不得感慨一下
- MediaRecorder 录制视频不支持暂停续录的问题
- AndroidStudio集成科大讯飞语音SDK