设置透明效果 大概有三种

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. Linux系统添加Android(安卓)SDK环境变量以及设置Android(安卓)St
  2. 文字跑马灯效果
  3. EditView属性介绍
  4. Eclipse for Android开发环境设置
  5. Android(安卓)Studio 简单设置
  6. AndroidUi(2)-圆角矩形
  7. Android(安卓)Activity全屏和设置背景色
  8. Kotlin 写 Android(安卓)单元测试(二),JUnit 4 测试框架和 kotlin.t
  9. Android(安卓)控件(button)对齐方法实现详解

随机推荐

  1. Android中单APK应用多进程
  2. 手动更新Android(安卓)SDK
  3. Android(安卓)之 zygote 与进程创建
  4. Android自动化测试工具——Monkey .
  5. android EditText 取消自动获取焦点
  6. android + cygwin + cocos2d-x环境搭建
  7. Android中调用jni
  8. Android(安卓)内功心法(1.10)——android
  9. Android底层开发之Audio HAL
  10. Android中使用ViewPager制作广告栏滚屏效