I use the following xml file to change the color of the editbox. But I would like to know how to change the color of the text in the edit box according to the focus. If the edit field is concentrated, I like to change the color of the text to black, and when it does not focus, I like to change the color to white.
How to implement this in an XML file? Any help would be really helpful for me in exploring the resources available for Android.
<?xml version="1.0" encoding="UTF-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true">
<shape>
<gradient
android:endColor="#FFFFFF"
android:startColor="#FFFFFF"
android:angle="90" />
<stroke
android:width="3dp"
android:color="#0f0f0f" />
<corners
android:radius="10dp" />
</shape>
</item>
<item android:state_focused="false">
<shape>
<gradient
android:endColor="#000000"
android:startColor="#000000"
android:angle="90" />
<stroke
android:width="3dp"
android:color="#151515" />
<corners
android:radius="10dp" />
</shape>
</item>
source
share