Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Android-EditText Border is not visible

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You are missing the width on stroke tags.

This should work:

<stroke android:color="@color/border" android:width="5dp"/>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading