大概有三种

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 Studio实现代码混淆
  2. Android之打开闪光灯关键代码
  3. Android代码混淆官方实现方法
  4. Android进度条源代码
  5. Android中使用ViewPage进行广告轮播测试代码
  6. Android Wi-Fi 设置带宽代码流程
  7. Android第一行代码笔记
  8. Android的源代码结构
  9. Android开发常用代码片段(二)

随机推荐

  1. c语言中的关键字有哪些类型?
  2. c语言中long是什么意思
  3. c语言0x什么意思
  4. printf在c语言中什么意思
  5. c语言中void的含义
  6. c语言的基本组成单位是什么
  7. c语言switch case语句怎么用
  8. c语言strcpy函数用法
  9. c语言scanf是啥意思
  10. scanf和getchar的区别