Implementing custom Edittext style in android -
i creating custom edit text in android adding xml in drawable res.it following
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <!-- border --> <item> <shape> <solid android:color="@color/gray"></solid> </shape> </item> <!-- body --> <item android:bottom="1dp" android:right="0dp" android:left="0dp" android:top="0dp"> <shape> <solid android:color="@color/white"></solid> </shape> </item> </layer-list> <edittext android:id="@+id/edt_password" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:background="@drawable/edittext" android:digits="1234567890" android:ellipsize="end" android:focusableintouchmode="true" android:inputtype="numberpassword" android:singleline="true" android:textcolor="@color/dark" />
so want edittext single line. when implement this, few seconds upper border of edittext visible , goes away... not getting why happening...
create res/drawable/custom_edittext_style.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_window_focused="false" android:state_enabled="true" android:drawable="@drawable/apptheme_textfield_default_holo_light" /> <item android:state_window_focused="false" android:state_enabled="false" android:drawable="@drawable/apptheme_textfield_disabled_holo_light" /> <item android:state_enabled="true" android:state_focused="true" android:drawable="@drawable/apptheme_textfield_activated_holo_light" /> <item android:state_enabled="true" android:state_activated="true" android:drawable="@drawable/apptheme_textfield_focused_holo_light" /> <item android:state_enabled="true" android:drawable="@drawable/apptheme_textfield_default_holo_light" /> <item android:state_focused="true" android:drawable="@drawable/apptheme_textfield_disabled_focused_holo_light" /> <item android:drawable="@drawable/apptheme_textfield_disabled_holo_light" />
and add require drawable file drawable folder.
<edittext android:id="@+id/edt_password" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:background="@drawable/custom_edittext_style" android:digits="1234567890" android:ellipsize="end" android:focusableintouchmode="true" android:inputtype="numberpassword" android:singleline="true" android:textcolor="@color/dark" />
Comments
Post a Comment