【问题标题】:EditText theme in custom themed dialog自定义主题对话框中的 EditText 主题
【发布时间】:2012-04-24 11:45:20
【问题描述】:

我已经为我的对话框创建了一个简单的自定义主题,但是现在使用这个主题的对话框中的 EditText 元素没有保留漂亮的默认 ICS 主题。

这是我使用的主题:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="DarkDialog" parent="@android:style/Theme.Dialog">
    <item name="android:windowFrame">@null</item>
    <item name="android:windowTitleStyle">@style/DarkDialogTitle</item>
    <item name="android:background">#282828</item>
</style>
<style name="DarkDialogTitle">
    <item name="android:textColor">#33B5E5</item>
    <item name="android:paddingLeft">16dip</item>
    <item name="android:paddingRight">16dip</item>
     <item name="android:textSize">22sp</item>
</style>

这就是我使用它时看到的:

有没有办法让我的自定义主题对话框中的 EditText 元素在任何设备上使用默认主题?

【问题讨论】:

    标签: android themes


    【解决方案1】:

    您需要为每个要控制的 API 级别设置一个主题。

    对于小于 11 的 API 值,您的风格基于 @android:style/Theme

    11 到 13 点之间@android:style/Theme.Holo

    对于 14 岁及以上的人@android:style/Theme.DeviceDefault

    【讨论】:

      【解决方案2】:

      我猜你需要从 Holo 对话主题派生:

      <style name="DarkDialog" parent="@android:style/Theme.Holo.Dialog">
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2018-05-16
        • 1970-01-01
        • 1970-01-01
        • 2011-01-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多