-3

anybody could tell me, how to put a border in an editText in AndroidStudio?

for example a square in an editText.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
O.Sanchez
  • 15
  • 1
  • 3

2 Answers2

5

It's so easy bro

First step create an shape.xml in your directory drawable

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke 
    android:width="1dp"
    android:color="@android:color/black"/>
</shape>

Second step create your editext in your layout.xml and put background with the shape that you created above

<EditText
    android:id="@+id/edittext"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/shape"/>

It's all

Abner Escócio
  • 2,697
  • 2
  • 17
  • 36
2

just try this one,

first create one XML file, inside drawable folder (use new drawable xml) and add this lines

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"/>      
<solid android:color="#000000"/>
<stroke
    android:color="#ffffff"
    android:width="05dp"/>
<corners android:radius="20dp"/>

then add this line inside Your edittext property

android:background="@drawable/(file_name)"

i don't know what your expecting, maybe it will help you

Farshid Ahmadi
  • 437
  • 6
  • 23