Android-小型,中,大的覆盖物



我正在尝试覆盖我的android应用中的默认文本

这是我的styles.xml,但它不起作用(用于文本视图,picker等...)

<?xml version="1.0" encoding="UTF-8"?>
<resources>
  <style name="newTheme" parent="newTheme.Base"></style>
  <style name="newTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/primary</item>
    <item name="colorPrimaryDark">@color/primaryDark</item>
    <item name="colorAccent">@color/accent</item>
  </style>
  <style name="TextAppearance.Large" parent="newTheme">
    <item name="android:textSize">11sp</item>
  </style>
  <style name="TextAppearance.Medium" parent="newTheme">
    <item name="android:textSize">11sp</item>
  </style>
  <style name="TextAppearance.Small" parent="newTheme">
    <item name="android:textSize">11sp</item>
  </style>

</resources>
<style name="TextAppearance.Large" parent="TextAppearance.AppCompat.Large">
  <item name="android:textSize">11sp</item>
</style>
<style name="TextAppearance.Medium" parent="TextAppearance.AppCompat.Medium">
  <item name="android:textSize">11sp</item>
</style>
<style name="TextAppearance.Small" parent="TextAppearance.AppCompat.Small">
  <item name="android:textSize">11sp</item>
</style>

请记住,要查看您的更改,您必须在布局中引用它们

    <TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textAppearance="@style/TextAppearance.Small"/>

或以样式参考它们

<style name="newTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/primary</item>
    <item name="colorPrimaryDark">@color/primaryDark</item>
    <item name="colorAccent">@color/accent</item>
    <item name="android:textAppearanceLarge">@style/TextAppearance.Large</item>
    <item name="android:textAppearanceMedium">@style/TextAppearance.Medium</item>
    <item name="android:textAppearanceSmall">@style/TextAppearance.Small</item>
</style>

相关内容

  • 没有找到相关文章