活动无法识别自定义主题

时间:2015-12-15 05:00:30

标签: android android-activity android-manifest android-5.0-lollipop android-xml

我尝试了3个不同的地方(清单,onCreate和XML)来获取单个活动的自定义主题,但它只是不起作用?它在genymotion&在设备上也是如此。清单代码

<activity
        android:name=".HomepageActivity"
        android:label="@string/title_activity_homepage"
        android:theme="@style/SecondTheme">
</activity>

这是onCreate

super.onCreate(savedInstanceState);
    setTheme(R.style.SecondTheme);
    setContentView(R.layout.activity_homepage);

这是XML

xmlns:app="http://schemas.android.com/apk/res-auto"
android:theme="@style/SecondTheme"
android:layout_width="match_parent"
android:layout_height="match_parent"

这是样式v21 / styles.xml

<style name="SecondTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here -->

    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:textColorPrimary">@color/colorTextPrimary</item>
    <item name="android:textColorSecondary">@color/colorTextSecondary</item>

</style>

任何人都能看到我做错了什么???

1 个答案:

答案 0 :(得分:0)

根据您的代码,主题仅适用于v21。将主题文件移动到值文件夹

相关问题