I have an EditText
with a drawableLeft
image. I need to add a vertical line in EditText
right beside my drawableLeft
like this example:
Easiest way that I can think of is to add that line into my drawable image. But generally is there any other way to do this?
You can create a layout
and attache to the editText as a property
android:drawableRight="@android:drawable/your_layout"
for example
<EditText
android:width="match_parent"
android:drawableLeft="@android:drawable/your_layout"
/>
in your your_layout.xml
file you can put anything you want.
Please check this
Fairly simple!
Just add a 'FrameLayout
'
<FrameLayout
android:id="@+id/vertical_divider"
android:layout_width="2dp"
android:layout_height="48dp"
android:layout_toEndOf="@+id/<your_object>"
android:layout_toRightOf="@+id/<your_object>"
android:background="@color/grey" />
Replace <your_object>
with your drawable image.
Try this , your issue solved
In your .xml file ,
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@drawable/customborder"
android:gravity="center|left"
android:minHeight="40dip"
android:orientation="horizontal"
android:padding="5dip"
android:weightSum="2">
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/img_clear_to"
android:layout_width="30dip"
android:layout_height="30dip"
android:src="@drawable/ic_action_delete" />
</LinearLayout>
<View
android:id="@+id/vvv1"
android:layout_width="2dp"
android:layout_height="match_parent"
android:background="@color/colorAccent" />
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1.8"
android:orientation="vertical">
<TextView
android:id="@+id/text_to"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:padding="5dip"
android:text="@string/text_to"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/black"
android:textSize="@dimen/font_normal_size" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
customborder.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:radius="2dp"
android:topRightRadius="0dp"
android:bottomRightRadius="0dp"
android:bottomLeftRadius="0dp" />
<stroke
android:width="1dp"
android:color="@android:color/black" />
</shape>