【发布时间】:2015-12-15 05:00:29
【问题描述】:
我尝试了 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>
有人看到我做错了吗???
【问题讨论】:
标签: android android-activity android-manifest android-5.0-lollipop android-xml