EditText background not working in Android 4(ICS)

368 Views Asked by At

I am trying to set background to EditText widget, but this seems to be working in devices android 5 and above but not in android 4. In android 4 I don't get a border instead the entire edittext is getting covered with the background. The background I am trying to set is a black border around the EditText. Code:

<EditText
    android:id="@+id/xfd"
    android:layout_width="300dp"
    android:layout_height="wrap_content"
    android:background="@drawable/texview_border"/>

The android:background="@drawable/texview_border" sets the border around the EditText, code for it as below:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <stroke
        android:width="1dp"
        android:color="@color/black" />
</shape>

The issue is as below:

enter image description here

1

There are 1 best solutions below

2
sasikumar On BEST ANSWER

Set solid android:color="#FFFFFF" in texview_border.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#FFFFFF" />
<stroke
    android:width="1dp"
    android:color="@color/black" />
</shape>