i want to create edittext with square border in android xml this is my edittext and the drawable added to it
<EditText
android:layout_width="wrap_content"
android:id="@ id/codeFirst"
android:padding="@dimen/appbar_padding"
android:layout_height="wrap_content"
android:background="@drawable/edittext_border"
android:lines="2"/>
this is the drawable
<?xml version="1.0" encoding="UTF-8" ?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffff" />
<stroke android:width="2dp"
android:color="@color/colorsubtext" />
<padding android:left="2dp" android:top="2dp"
android:right="2dp" android:bottom="2dp" />
</shape>
the edittext look like rectangle rotated, i need to make it square one, all border side are equal
CodePudding user response:
If you want a square border on the edittext
, then you have to specify the width
and height
instead of using wrap_content
.
android:layout_width="100dp"
android:layout_height="100dp"
CodePudding user response:
you can follow this one
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="2dp"
android:color="@color/color_primary" />
<corners android:radius="0dp" />
</shape>