Android EditText Transparent Background
I want to have a transparent background for Android EditText widget. H开发者_StackOverflow社区ow is that possible?
Try this
android:background="@null"
android:background="@android:color/transparent"
You can also set it using java code
myTextView.setBackgroundColor(Color.TRANSPARENT);
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);
Very simple:
android:alpha="0.5"
Put this property in edittext:
android:background="@null"
android:background="#00000000"
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);
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"
set this in layout will work
android:background="@color/transparent
and add this in colors.xml
<color name="transparent">#00000000</color>
For XML code use:
android:background="@color/transparent
or
android:background="@null"
For Java code:
myEditText.setBackgroundColor(Color.TRANSPARENT);
Use translucent theme
<activity android:theme="@android:style/Theme.Translucent">
精彩评论