TextView和背景颜色

dil*_*tes 3 android colors background-color textview

我想为我的textview背景颜色设置透明的黑色.我该怎么做?

小智 8

android:background="#55000000"
Run Code Online (Sandbox Code Playgroud)

如果使用8个数字而不是6个数字,前两个设置不透明度.在这种情况下,不透明度为0x55,即85/255 [大约33%不透明度].

对于程序设计,您应该能够使用以下内容(其中myTextView对应于您的视图)

myTextView.setBackgroundColor(0x55000000);
Run Code Online (Sandbox Code Playgroud)