举个列子你想对某个控件背景变得透明,你可以直接在xml布局文件中定义
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
androiid:background="#a0000000">
androiid:background="#a0000000"就是这句 定义了背景颜色和透明度 a0代表的是透明度多少,000000代表的是背景是什么颜色
很简单吧!