How To Set Line As A Background Using Xml (shape) Below To Edittext?
I want to set the line as background below EditText using shape xml but when I set it line set on center I want like below but when I set the shape below drawable/line.xml
Solution 1:
Try this one i hope you will get perfect solution..
<?xml version="1.0" encoding="utf-8"?><layer-listxmlns:android="http://schemas.android.com/apk/res/android" ><item><shape><solidandroid:color="@color/gray" /></shape></item><!-- main color --><itemandroid:bottom="1dp"android:left="1dp"android:right="1dp"><shape><solidandroid:color="@color/white" /></shape></item><!-- draw another block to cut-off the left and right bars --><itemandroid:bottom="1dp"><shape><solidandroid:color="@color/white" /></shape></item></layer-list>
Or Try this
<?xml version="1.0" encoding="utf-8"?><layer-listxmlns:android="http://schemas.android.com/apk/res/android" ><item><shape><solidandroid:color="@color/gray" /></shape></item><itemandroid:bottom="1px"android:left="0px"><shapeandroid:shape="rectangle" ><solidandroid:color="#FFFFFF" /></shape></item></layer-list>
Solution 2:
Try this way,hope this will help you to solve your problem.
<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical"android:padding="20dp"><EditTextandroid:id="@+id/edt1"android:layout_width="match_parent"android:layout_height="wrap_content"android:textColor="@android:color/black"/><Viewandroid:layout_width="match_parent"android:layout_height="4dp"android:background="@drawable/line"/><EditTextandroid:id="@+id/edt2"android:layout_width="match_parent"android:layout_height="wrap_content"android:textColor="@android:color/black"/><Viewandroid:layout_width="match_parent"android:layout_height="4dp"android:background="@drawable/line"/></LinearLayout>
Solution 3:
Try this code just below your EDIT_text:
<Viewandroid:id="@+id/dividerView"android:layout_width="match_parent"android:layout_height="1dp"android:background="#191919"
></View>
Post a Comment for "How To Set Line As A Background Using Xml (shape) Below To Edittext?"