I want to have a transparent background for Android EditText widget. How is that possible?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Try this
android:background="@null"
回答2:
android:background="@android:color/transparent"
回答3:
You can also set it using java code
myTextView.setBackgroundColor(Color.TRANSPARENT);
回答4:
Very simple:
android:alpha="0.5"
回答5:
Put this property in edittext:
android:background="@null"
回答6:
android:background="#00000000"
回答7:
You can also do it programitically like this:
TypedValue value= new TypedValue();
getApplicationContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, value, true);
myButton.setBackgroundResource(value.resourceId);
回答8:
EditText, like any other view/component can be customized in the xml file. You just need to include below attribute in the EditText attributes.
android:background="@null"
回答9:
in xml file you use this property:
android:background="@android:color/transparent"
and in java file run time in onCreate method use:
edittext.setBackgroundColor(Color.TRANSPARENT);
回答10:
set this in layout will work
android:background="@color/transparent
and add this in colors.xml
<color name="transparent">#00000000</color>
回答11:
Use translucent theme
<activity android:theme="@android:style/Theme.Translucent">