所有活动视图都没有选择主题

use*_*104 5 android themes view

我有这个自定义样式:

<resources>
    <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="AppTheme.AppText">
        <item name="android:fontFamily">@font/book_family</item>
    </style>
</resource>
Run Code Online (Sandbox Code Playgroud)

我通过在清单中添加以下内容,将此新样式作为主题应用于我的一个活动:

...
<activity android:name=".MyActivity"
            android:theme="@style/AppTheme.AppText"/>
...
Run Code Online (Sandbox Code Playgroud)

结果不是我的预期.只有少数几个视图选择了自定义样式.下图显示了两个视图.第一个FIELD ONE没关系.FIELD TWO字段不会提取样式.

在此输入图像描述

以下是这两个字段的定义:

<android.support.design.widget.TextInputLayout
    android:id="@+id/til_email"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <AutoCompleteTextView
        android:id="@+id/email"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/prompt_email"
        android:inputType="number"
        android:imeOptions="actionNext"
        android:maxLines="1"
        android:singleLine="true" />
</android.support.design.widget.TextInputLayout>

<android.support.design.widget.TextInputLayout
    android:id="@+id/til_password"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <EditText
        android:id="@+id/password"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/prompt_password"
        android:imeActionId="6"
        android:imeActionLabel="@string/action_sign_in_short"
        android:imeOptions="actionUnspecified"
        android:inputType="numberPassword"
        android:maxLines="1"
        android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)

请问,任何想法?

use*_*104 0

由于只有一个视图受到影响,我不介意用 Java 解决它,方法如下:

TextInputLayout til_passw = findViewById(R.id.til_password);
Typeface typeface = ResourcesCompat.getFont(this, R.font.book_family);
til_passw.setTypeface(typeface);
Run Code Online (Sandbox Code Playgroud)