设置背景的途径
yourView.setBackgroundResource(R.drawable.your_picture);
yourView.setBackgroundDrawable(getResources().getDrawable(R.drawable.your_picture));
yourView.setBackgroundColor(Color.parseColor("#FFFF0000"));
yourView.setBackgroundColor(Color.RED);
android:background="@android:drawable/your_picture"
android:background="#33333333"
设置背景的颜色效果
android:background="@android:color/transparent"
android:theme="@android:style/Theme.Translucent"
View v = findViewById(R.id.your_view);
v.getBackground().setAlpha(100); // 值越小越透明
android:background="#80000000"
网友评论