首先,在java文件中,用findViewById获取对应的组件, 如:mLayout=(LinearLayout)findViewById(R.id.layout);
然后在设置 : mLayout.getBackground().setAlpha(150) ; 参数值取0-255之间
ImageView组件可以直接设置 Alpha,imageView.setAlpha(100);
首先,在java文件中,用findViewById获取对应的组件, 如:mLayout=(LinearLayout)findViewById(R.id.layout);
然后在设置 : mLayout.getBackground().setAlpha(150) ; 参数值取0-255之间
ImageView组件可以直接设置 Alpha,imageView.setAlpha(100);