冰淇淋三明治打破了EditText的setError()?

时间:2012-01-13 22:40:01

标签: android android-edittext android-4.0-ice-cream-sandwich

我在EditText上使用setError()进行验证。它在升级到ICS之前工作正常,但现在错误框为空。我该如何解决这个问题?

2 个答案:

答案 0 :(得分:8)

我能够在运行Android 4.0.3的Nexus S上重现这一点。

以下是我如何使其发挥作用。

  1. 使用以下内容创建主题:

    <style name="MyApp.Theme.Light.NoTitleBar" parent="@android:style/Theme.Light.NoTitleBar">
         <item name="android:textColorPrimaryInverse">@android:color/primary_text_light
         </item>
    </style>
    
  2. 从清单中将MyApp.Theme.Light.NoTitleBar主题应用于我的应用程序/活动。

        <application
             android:name=".MyApp"
             android:icon="@drawable/ic_launcher"
             android:label="@string/app_name" 
             android:theme="@style/MyApp.Theme.Light.NoTitleBar"
        >
    

答案 1 :(得分:2)

它可能与此报告的错误有关吗?

Issue 22920: EditText: setError not readable when using Light Theme

不知道如何解决或绕过它。 =(

相关问题