I am creating an EditText in my layout xml file, But I want to change color line in EditText from Holo to (for example) red. How that can be done?

you can change the following code change EditText boder color.
Step 1. Create layout activity-layout.xml
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
tools:context=".MainActivity"
android:background="#c9cac1"
>
<EditText
android:id="@+id/et"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Input your country"
android:background="@drawable/edittext_bg"
android:padding="10dp"
/>
</RelativeLayout>
Step 2. Create res/drawable/edittext_bg.xml
<?xml version="1.0" encoding="utf-8"?>The following are the results of the program change EditText botom bodercolor Android.
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<stroke
android:color="#ff1e0c"
android:width="2dp"
/>
</shape>
</item>
<item
android:bottom="2dp"
>
<shape android:shape="rectangle">
<solid android:color="#fffbce"/>
</shape>
</item>
</layer-list>

No comments
Post a Comment