【问题标题】:Editext has some strange color [duplicate]Edittext有一些奇怪的颜色[重复]
【发布时间】:2016-11-19 12:43:57
【问题描述】:

您好,我在 19+ 版本中有一些 EditText 显示正常,但在 19 及更低版本中我得到了这个结果。 editText image

这是我的代码:

<EditText
    android:id="@+id/player_name_edittext"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="@string/name_hint"
    android:contentDescription="@string/a11y_enter_player_name"
    android:fontFamily="sans-serif-light"/>

这是我的styles.xml

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

<style name="DargetTheme" parent="AppTheme" />

<!-- Toolbar theme -->
<style name="ToolbarTheme" parent="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
    <item name="android:textColorPrimary">@color/colorWhite</item>
</style>

<!-- Settings activity theme. -->
<style name="SettingsTheme" parent="DargetTheme" />

任何帮助都会很棒!谢谢!

【问题讨论】:

  • 添加这个classpath 'com.android.tools.build:gradle:2.1.0'
  • @SagarJogadia 非常感谢,这解决了问题!

标签: android colors android-edittext styles


【解决方案1】:

这是 Android Studio 2.2 预览版的 Bug,在 Android Studio 预览版 4 和 5 中得到解决

我建议你用新版本更新 gradle

Android studio 2.2 Preview 4 或 5

http://tools.android.com/recent/androidstudio22preview4available

或者您使用 Gradle 2.1.0

classpath 'com.android.tools.build:gradle:2.1.0'

【讨论】:

  • 非常感谢!这解决了问题!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-01-22
相关资源
最近更新 更多