I wanna ask how i can change EditText border then it on focus. I want to change original orange gradiant to my own.
问问题
5357 次
2 回答
5
嗨,您可以在可绘制文件夹中创建这样的渐变。
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient
android:startColor="#5a5a5a88"
android:endColor="#14141488"
android:angle="270" android:centerX="0.25"/>
</shape>
</item>
<item android:top="80dp">
<shape android:shape="rectangle">
<gradient
android:startColor="#5aff5a88"
android:endColor="#14ff1488"
android:angle="270" android:centerX="0.25"/>
</shape>
于 2012-08-08T12:19:15.467 回答
3
在drawable文件夹中创建一个文件。粘贴下面的代码。还可以根据需要提供适当的图像。
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_enabled="true"
android:drawable="@drawable/textfield_default" />
<item android:state_window_focused="false" android:state_enabled="false"
android:drawable="@drawable/textfield_disabled" />
<item android:state_pressed="true" android:drawable="@drawable/textfield_pressed" />
<item android:state_enabled="true" android:state_focused="true" android:drawable="@drawable/textfield_selected" />
<item android:state_enabled="true" android:drawable="@drawable/textfield_default" />
<item android:state_focused="true" android:drawable="@drawable/textfield_disabled_selected" />
<item android:drawable="@drawable/textfield_disabled" />
</selector>
这将完美地工作。
于 2012-08-08T12:00:23.807 回答