Android EditText Transparent Background

前端 未结 11 1735
天涯浪人
天涯浪人 2020-12-05 09:33

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

相关标签:
11条回答
  • 2020-12-05 09:38

    Put this property in edittext:

    android:background="@null"
    
    0 讨论(0)
  • 2020-12-05 09:41

    You can also set it using java code

    myTextView.setBackgroundColor(Color.TRANSPARENT);
    
    0 讨论(0)
  • 2020-12-05 09:41

    Use translucent theme

    <activity android:theme="@android:style/Theme.Translucent">
    
    0 讨论(0)
  • 2020-12-05 09:43
    1. in xml file you use this property:

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

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

      edittext.setBackgroundColor(Color.TRANSPARENT);

    0 讨论(0)
  • 2020-12-05 09:44
    android:background="#00000000"
    
    0 讨论(0)
  • 2020-12-05 09:53

    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);
    
    0 讨论(0)
提交回复
热议问题