I want to draw a border like this ,
Bordered Edittext
my code is as follows:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/blue" />
</shape>
</item>
<item
android:bottom="2dp"
android:left="2dp"
android:right="2dp">
<!--// add android:right="5dp" and android:left="5dp" for border on left and right-->
<shape android:shape="rectangle">
<padding
android:bottom="5dp"
android:left="5dp"
android:right="5dp"
android:top="5dp" />
<solid android:color="@color/bill_background" />
</shape>
</item>
</layer-list>
I managed to do something like this: My Edittext
I cant seem to adjust the height of the left and right sided borders.
Try this code! this will surely help
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<solid android:color="#00f" />
<padding android:bottom="2dp" />
</shape>
</item>
<item android:bottom="10dp">
<shape android:shape="rectangle" >
<solid android:color="#fff" />
<padding
android:left="2dp"
android:right="2dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<solid android:color="#fff" />
</shape>
</item>
</layer-list>
Toufiq Akbar.
You should use Vector drawable.
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="400.0"
android:viewportWidth="580.0">
<path
android:fillColor="#00000000"
android:pathData="M41.5,318L534.7,318"
android:strokeColor="#000"
android:strokeWidth="1.5" />
<path
android:fillColor="#00000000"
android:pathData="M535.5,210L535.5,319"
android:strokeColor="#000"
android:strokeWidth="1.5" />
<path
android:fillColor="#00000000"
android:pathData="M42.5,209L42.5,318"
android:strokeColor="#000"
android:strokeWidth="1.5" />
</vector>
I think It is useful to you... :)
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:bottom="2dp"
android:left="2dp"
android:right="2dp">
<!--// add android:right="5dp" and android:left="5dp" for border on left and right-->
<shape android:shape="rectangle">
<padding
android:bottom="5dp"
android:left="5dp"
android:right="5dp" />
<solid android:color="@color/colorPrimary" />
</shape>
</item>
<item
android:bottom="2dp"
android:left="2dp"
android:right="2dp">
<shape android:shape="rectangle">
<stroke
android:width="3dp"
android:color="@color/red" />
<size android:height="50dp" />
<padding
android:bottom="10dp"
android:left="5dp"
android:right="5dp" />
</shape>
</item>
<item>
<!--// add android:right="5dp" and android:left="5dp" for border on left and right-->
<shape android:shape="rectangle">
<padding android:bottom="5dp" />
<solid android:color="@color/colorPrimary" />
</shape>
</item>
</layer-list>
Use this.