Change Style Of EditText Android ICS Style to Old Style

on Sunday, January 6, 2013 | 9:41 PM


Changes to the version of the android version 4.0 or ICS (Icescream Sandwich) brings many changes. One is the default theme (default) on the application. When in android in older versions, EditText used are conventional white box, whereas in version 4.0 using a EditText which only has the bottom line (not a box). It looks more modern, but there are also assuming that EditText on version ICS EditText less user friendly than the conventional ones.

So, for example, we are comfortable with themed version of ICS, but would like to replace just the EditText EditText to older versions.

Actually on any android sdk, it includes a collection of XML files that can be seen for reference. Likewise for EditText. Inspect the android sdk directory older versions you on the path here:
<android_sdk>\platforms\android-x.x\data\res\drawable</android_sdk>
Open the file edit_text.xml, contents:

<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>
  <item android:state_window_focused="false" android:state_enabled="false" android:drawable="@drawable/textfield_disabled"></item>
  <item android:state_pressed="true" android:drawable="@drawable/textfield_pressed"></item>
  <item android:state_enabled="true" android:state_focused="true" android:drawable="@drawable/textfield_selected"></item>
  <item android:state_enabled="true" android:drawable="@drawable/textfield_default"></item>
  <item android:state_focused="true" android:drawable="@drawable/textfield_disabled_selected"></item>
  <item android:drawable="@drawable/textfield_disabled"></item>
</selector>

These files will be used. Keep drawable into your project directory.

Next we need the image file as a background EditText. The image file also can we take on the directory:
drawable-mdpi
file name is:

textfield_default.9.png
textfield_disabled.9.png
textfield_disabled_selected.9.png
textfield_pressed.9.png
textfield_search_default.9.png
textfield_search_selected.9.png
textfield_search_pressed.9.png
textfield_selected.9.png
textfield_disabled_selected.9.png

copy also to the drawable-mdpi directory you.

Then you simply call last edit_text.xml file into your EditText layout, eg:

<edittext android:id="@+id/edit2"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:inputType="text"
        android:background="@drawable/edit_text"></edittext>

Finish.
Share this post :
Change Style Of EditText Android ICS Style to Old Style Published By Technoledge Terima Kasih Telah membaca Change Style Of EditText Android ICS Style to Old Style
Link Published on: 2013-01-06T21:41:00+07:00
Changes to the version of the android version 4.0 or ICS (Icescream Sandwich) brings many changes. One is the default theme (default) on t... Rating 5 ★★★★★ Reviews 1110
Index »

Android App

 
Copyright © 2013. Technoledge - All Rights Reserved
Proudly powered by Blogger