Android EditText Transparent Background

AndroidAndroid EmulatorAndroid WidgetAndroid Manifest

Android Problem Overview


I want to have a transparent background for Android EditText widget. How is that possible?

Android Solutions


Solution 1 - Android

Try this

android:background="@null"

Solution 2 - Android

android:background="@android:color/transparent"

Solution 3 - Android

You can also set it using java code

myTextView.setBackgroundColor(Color.TRANSPARENT);

Solution 4 - Android

  1. in xml file you use this property:

android:background="@android:color/transparent"

  1. and in java file run time in onCreate method use:

edittext.setBackgroundColor(Color.TRANSPARENT);

Solution 5 - Android

Very simple:

android:alpha="0.5"

Solution 6 - Android

Put this property in edittext:

android:background="@null"

Solution 7 - Android

android:background="#00000000"

Solution 8 - Android

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);

Solution 9 - Android

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"

Solution 10 - Android

set this in layout will work

android:background="@color/transparent

and add this in colors.xml

<color name="transparent">#00000000</color>

Solution 11 - Android

For XML code use:

android:background="@color/transparent

or

android:background="@null"

For Java code:

myEditText.setBackgroundColor(Color.TRANSPARENT);

Solution 12 - Android

Use translucent theme

<activity android:theme="@android:style/Theme.Translucent">

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSultan SaadatView Question on Stackoverflow
Solution 1 - AndroidDmitry RyadnenkoView Answer on Stackoverflow
Solution 2 - AndroidemboView Answer on Stackoverflow
Solution 3 - AndroiddaffycricketView Answer on Stackoverflow
Solution 4 - AndroidMirza AdilView Answer on Stackoverflow
Solution 5 - AndroidMatheus Henrique da SilvaView Answer on Stackoverflow
Solution 6 - AndroidsandeepmaaramView Answer on Stackoverflow
Solution 7 - AndroidPankaj AroraView Answer on Stackoverflow
Solution 8 - AndroidIsjView Answer on Stackoverflow
Solution 9 - AndroidPaathak KumarView Answer on Stackoverflow
Solution 10 - AndroidDASView Answer on Stackoverflow
Solution 11 - AndroidZakaria HossainView Answer on Stackoverflow
Solution 12 - AndroidyogsmaView Answer on Stackoverflow