Android EditText 的 Holo 主题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12728155/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 11:35:39  来源:igfitidea点击:

Holo Theme For EditText

androidviewthemesandroid-edittext

提问by user1340801

I have a username TextViewbelow which there is EditTextand the same for password.I need just the EditTextto be changed to Holo theme for respective devices.. I've tried setting parent in style.xmlas

我有一个用户名,TextView下面有一个用户名EditText,密码也一样EditText。我只需要将相应设备的 Holo 主题更改为 .. 我试过将 parent 设置style.xml

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

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

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!!!!

嗨,我得到了答案。原因是调用此对话框的活动在清单中具有主题 android:theme="@android:style/Theme.Translucent.NoTitleBar" ..我删除并添加到 oncreate 中,editText 出现全息!!!!

回答by JafarKhQ

use holoeverywherelib

使用全息

OR

或者

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

您可以使用android-holo-colors下载zip.then生成edittext Holo 样式,然后设置edittext 背景

回答by Alfaplus

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>

回答by James McCracken

Add the styleattribute in your EditTextin your XML

style在你的属性中添加EditText你的XML

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

回答by mbonness

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:

根据 Android 开发者网站,如果需要 Holo 主题,我们应该对显示为对话框的活动使用以下主题:

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

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

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