我想为Android EditText窗口部件设置透明背景。这是否可能?
我想为Android EditText窗口部件设置透明背景。这是否可能?
试试这个
android:background="@null"
android:background="@android:color/transparent"
你也可以使用Java代码设置它。
myTextView.setBackgroundColor(Color.TRANSPARENT);
在xml文件中,你可以使用以下属性:
android:background="@android:color/transparent"
在Java文件中,在onCreate方法中运行以下代码:
edittext.setBackgroundColor(Color.TRANSPARENT);
android:alpha="0.5"
android:background="@null"
android:background="#00000000"
EditText, 就像其他视图/组件一样,可以在xml文件中进行自定义。只需要在EditText属性中包含以下属性即可。
android:background="@null"
TypedValue value= new TypedValue();
getApplicationContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, value, true);
myButton.setBackgroundResource(value.resourceId);
在布局中设置这个将会起作用
android:background="@color/transparent
并将其添加到colors.xml文件中
<color name="transparent">#00000000</color>