I saw many related discussions but didn't find a suitable solution. What I need to do is to create a black border on the bottom side of an EditText widget. Is that possible?
Create EditText with rounded corners border. EditText can be easily modified through activity_main. xml file via adding another layout file and set that rounded_border_edittext. xml file to editText background. This type of editText looks like most of web sites applications data submission forms.
setBackgroundResource(R. layout. border); This will make a black line on top and bottom of the TextView.
Show activity on this post. To change Edittext's underline color: Then change the “colorAccent” to whatever the color you want your EditText line color to be.
In your xml code set focusable="false" , android:clickable="false" and android:cursorVisible="false" and this will make your EditText treat like non editable.
simple create one edittext_bottom_line.xml file in drawable folder in res
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:bottom="1dp"
android:left="-2dp"
android:right="-2dp"
android:top="-2dp">
<shape android:shape="rectangle" >
<stroke
android:width="0.5dp"
android:color="@android:color/black" />
</shape>
</item>
</layer-list>
To set control's single property like these:
<EditText
android:id="@+id/editTextEnterPassword"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="@drawable/edittext_bottom_line"
/>
just add underlinebg.xml in res/drawable
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:bottom="-1dp"
android:left="-2dp"
android:right="-2dp"
android:top="-2dp">
<shape android:shape="rectangle" >
<stroke
android:width="2dp"
android:color="@color/drawe_content_color_click" />
</shape>
</item>
</layer-list>
and set the background where ever required. For me i got the solution like [![myoutput!!][1]][1] .I think my answer will helpful for others.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With