Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android TextAppearance未应用于某些API版本_Android_Themes_Android Styles - Fatal编程技术网

Android TextAppearance未应用于某些API版本

Android TextAppearance未应用于某些API版本,android,themes,android-styles,Android,Themes,Android Styles,我有一个用XML创建的视图。然后,视图显示在两个片段之一上。作为暂停菜单,在我的游戏活动中替换棋盘,或在DialogFragment上的回合结束时作为分数摘要 “我的摘要”中的每个TextView都使用视图主题中声明的属性设置其textAppearance。这在我的Sony Xperia Z3 Compact上没有问题,运行API 22。然而,我妻子的手机上似乎根本没有显示文字。她的是一个运行API 19的Z3紧凑型。我还有一台运行API 17的平板电脑也有同样的问题 在每个有问题的设备上,所有

我有一个用XML创建的视图。然后,视图显示在两个片段之一上。作为暂停菜单,在我的游戏活动中替换棋盘,或在DialogFragment上的回合结束时作为分数摘要

“我的摘要”中的每个TextView都使用视图主题中声明的属性设置其textAppearance。这在我的Sony Xperia Z3 Compact上没有问题,运行API 22。然而,我妻子的手机上似乎根本没有显示文字。她的是一个运行API 19的Z3紧凑型。我还有一台运行API 17的平板电脑也有同样的问题

在每个有问题的设备上,所有文本都以非常小的文本大小显示。它还会忽略样式设置的textColor

每个组件的XML看起来像是此组件的变体:

<TableRow android:id="@+id/view_score_summary_group_overall_time">
    <TextView
        android:text="@string/time"
        android:textAppearance="?scoreSummaryTextAppearanceHeading"
        />
    <TextView android:id="@+id/view_score_summary_game_time"
        android:layout_column="2"
        android:textAppearance="?scoreSummaryTextAppearanceData"
        />
</TableRow>
这起作用了。但是,如果必须在每个组件上设置,为什么还要麻烦样式呢

  • 将textAppearance设置为Small而不是textAppearance。基于。这只是使所有的文本稍微大一点,但仍然没有应用我的风格

  • 设置样式而不是文本外观。这与设置textAppearanceSmall的结果相同
  • 使我的样式声明扩展“android:attr/textpearance”。没有改变任何事情,我也不知道为什么会这样,但我绝望了
  • 我已经看了很久了,我试着用谷歌搜索了一大堆东西,但都没找到

    这看起来不对。在我的平板电脑上——虽然在我妻子的手机上看起来很像

    应该是这样的。在我的电话上

    <style name="ScoreSummary.Light">
        <item name="scoreSummaryTextAppearanceHeading">@style/ScoreSummary.Light.TextAppearance.Heading</item>
        <item name="scoreSummaryTextAppearanceTitle">@style/ScoreSummary.Light.TextAppearance.Title</item>
        <item name="scoreSummaryTextAppearanceData">@style/ScoreSummary.Light.TextAppearance.Data</item>
    </style>
    
    <style name="ScoreSummary">
    </style>
    <style name="ScoreSummary.Light">
    </style>
    <style name="ScoreSummary.Light.TextAppearance">
        <item name="android:textColor">@color/text_score_summary_light</item>
    </style>
    <style name="ScoreSummary.Light.TextAppearance.Title">
        <item name="android:textSize">24sp</item>
    </style>
    <style name="ScoreSummary.Light.TextAppearance.Heading">
        <item name="android:textSize">16sp</item>
        <item name="android:gravity">start</item>
    </style>
    <style name="ScoreSummary.Light.TextAppearance.Data">
        <item name="android:textSize">16sp</item>
        <item name="android:gravity">end</item>
    </style>
    
    <com.abc.def.ScoreSummaryView android:id="@+id/fragment_game_score_summary"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="4dp"
        android:layout_gravity="center"
        android:theme="@style/ScoreSummary.Light"
        />
    
    android:textSize="150sp"