易采站长站为您分析Android2.3实现Android4.0风格EditText的方法,涉及Android界面布局及控件调用的相关技巧,需要的朋友可以参考下
本文实例讲述了Android2.3实现Android4.0风格EditText的方法。,具体如下:
效果如下:
思路:在源码里找到4.0风格的图片作为背景,xml文件定义点击时候边框变化
步骤:
1.在
D:Androidandroid-sdk-windowsandroid-sdk-windowsplatformsandroid-14dataresdrawable-xhdpi
目录下找到图片文件:
textfield_disabled_holo_light.9.png:
textfield_multiline_activated_holo_dark.9.png:
2.
在drawable文件夹下建立edittext_change.xml文件:
<?xml version= "1.0" encoding ="utf-8"?> <selector xmlns:android="http://www.easck.com/apk/res/android" > <item android:drawable="@drawable/textfield_activated_holo_dark" android:state_pressed= "true"/> <item android:drawable="@drawable/textfield_activated_holo_dark" android:state_focused= "true"/> <item android:drawable="@drawable/textfield_activated_holo_dark" android:state_selected= "true"/> <item android:drawable="@drawable/textfield_default_holo_light" /> </selector>













