Reputation:
I tried making a 9 patch image and setting that as background as many solutions suggest but that didn't change the border color when the edittext is selected. In fact, there is no border now, just the image of the edittext. How can I simply change the border color of it? To be for example blue instead of yellow.
Upvotes: 0
Views: 4169
Reputation: 139
Use the below step to change the border color.
Upvotes: 0
Reputation: 26198
You need to make a selector
when the Edittext
is focused
or selected
the image changes of the Edittext
.
sample:
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android"
>
<item
android:state_pressed="true"
android:drawable="@android:drawable/edittext_pressed"/> //9patch for pressed
<item
android:state_focused="true"
android:drawable="@drawable/edittext_focused"/> //9patch for focused
<item
android:drawable="@android:drawable/edittext_normal"/> //9patch for normal
</selector>
This selector is then added in the background of the Edittext
.
Upvotes: 1