简体   繁体   中英

Holo Theme For EditText

I have a username TextView below which there is EditText and the same for password.I need just the EditText to be changed to Holo theme for respective devices.. I've tried setting parent in style.xml as

parent="@android:style/Theme.Holo.

parent="@android:style/Widget.Holo.Light.EditText"

but of no use..Anyone has an answer??

Hi i got the answer. the cause was activity which calls this dialog had theme android:theme="@android:style/Theme.Translucent.NoTitleBar" in manifest ..i removed and added in oncreate and there comes holo for editText!!!!

use holoeverywhere lib

OR

you can generate the edittext Holo style using android-holo-colors download the zip.then set the edittext background

I had more or less the same problem. Here is my solution. =)

<style name="AppTheme" parent="android:Theme.Holo.Light">

            <item name="android:editTextStyle">@style/AppTheme.EditTextStyle</item>
            <item name="android:editTextBackground">@drawable/apptheme_edit_text_holo_dark</item>
        </style>

    <style name="AppTheme.EditTextStyle"  parent="@android:style/Widget.Holo.EditText">
        <item name="android:textSize">@dimen/etforlogin</item>
        <item name="android:singleLine">true</item>
        <item name="android:ellipsize">end</item>
        <item name="android:typeface">monospace</item>
    </style>

Add the style attribute in your EditText in your XML

<EditText
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    style="@android:style/Widget.Holo.EditText"/>

According to the Android developer site we are supposed to use the following theme for Activities that are displayed as a dialog if the Holo theme is desired:

<activity android:theme="@android:style/Theme.Holo.Dialog" >

http://developer.android.com/guide/topics/ui/dialogs.html#CustomLayout

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM