Home > other >  Android-EditText Border is not visible
Android-EditText Border is not visible

Time:11-25

I am trying to create a border around a EditText but it does not work Here is my EditText code

<EditText
    android:layout_width="match_parent"
    android:layout_height="150dp"
    android:layout_margin="16dp"
    android:autofillHints="no"
    android:background="@drawable/edit_text_border"
    android:hint="@string/text"
    android:inputType="number"
    android:padding="8dp"
    android:textColorHint="#757575" />

Here is my .xml code

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
    <stroke android:color="@color/border"/>
    <corners android:radius="5dp"/>
</shape>

Edit: I tried adding solid color but the whole box became of that color and not just border. the corners are fixed

CodePudding user response:

You are missing the width on stroke tags.

This should work:

<stroke android:color="@color/border" android:width="5dp"/>
  • Related