设置透明效果 大概有三种


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="#1FFFFFFF" />
透明<Button android:background="#00000000" />

3、设置alpha

Java代码
View v = findViewById(R.id.content);//找到你要设透明背景的layout 的id
v.getBackground().setAlpha(100);//0~255透明度值



更多相关文章

  1. Android系统中设置TextView的行间距(非行高)
  2. Android(安卓)JNI实战
  3. Android夜间模式官方api实现(AppCompatDelegate)
  4. android EditText 属性
  5. android edittext的属性
  6. [Android(安卓)特效] Android(安卓)通过流播放声音(一)
  7. Android水波纹效果
  8. 完美解决隐藏Listview和RecyclerView去掉滚动条和滑动到边界阴影
  9. android:layout_gravity="bottom"不起作用问题

随机推荐

  1. android > WebView > 布局
  2. virtualbox 安装android设置分辨率(自定
  3. android中MediaPlayer的用法
  4. 原:Android(安卓)获取屏幕高度、标题高度
  5. Android使用AchartEngine绘制曲线图
  6. android:TextAppearance.Material.Widget
  7. Android(安卓)Weak Handler:可以避免内存
  8. Android自定义样式
  9. android情景模式切换的实现
  10. Android的BUG(三) - 广为人知的诟病:频繁重