Psypher
Psypher

Reputation: 10839

EditText background not working in Android 4(ICS)

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

Upvotes: 0

Views: 370

Answers (1)

Sasi Kumar
Sasi Kumar

Reputation: 13348

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>

Upvotes: 4

Related Questions