简体   繁体   English

在框架活动中使用AppCompat主题

[英]Use AppCompat themes with framework activity

I want to use Theme.Appcompat.Light as the application theme to introduce Material Design to platform version 19: 我想使用Theme.Appcompat.Light作为应用程序主题,以将Material Design引入平台版本19:

<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light">

But I don't quite like extending support library ActionBarActivity since I'm not going to support platforms below version 19 and the framework Activity should already have an action bar in platform version 19. 但是我不太喜欢扩展支持库ActionBarActivity因为我将不支持版本19以下的平台,而框架Activity在平台版本19中应该已经有一个操作栏。

Is this possible? 这可能吗?

From the recent post on getting started with AppCompat : 从最近关于AppCompat入门的文章中:

If you are not currently using AppCompat, or you are starting from scratch, here's how to set it up: 如果您当前不使用AppCompat,或者从头开始,请按以下步骤进行设置:

All of your Activities must extend from ActionBarActivity, which extends from FragmentActivity from the v4 support library, so you can continue to use fragments. 您所有的活动都必须从ActionBarActivity扩展,而ActionBarActivity从v4支持库的FragmentActivity扩展,因此您可以继续使用片段。

So to answer your question 所以回答你的问题

Is this possible? 这可能吗?

No it is not. 不它不是。 You need to extend from ActionBarActivity to use the Theme.Appcompat.Light , even if you're not planning to support anything under v19. 您需要从ActionBarActivity扩展以使用Theme.Appcompat.Light ,即使您不打算在v19下支持任何功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法使用一些AppCompat主题和属性 - Cant use some AppCompat themes and attributes Android AppCompat主题 - Android AppCompat Themes Android中的AppCompat和主题问题 - Issue with AppCompat and Themes in Android “在此活动中使用 Theme.AppCompat 主题”异常 - "Use Theme.AppCompat theme with this activity" Exception Android-在单个Activity中使用Theme.AppCompat - Android - Use Theme.AppCompat in a single Activity Android appCompat主题vs基本主题 - Android appCompat themes vs Base themes 问题与您需要与此活动一起使用Theme.AppCompat主题(或后代)与该活动一起Theme.AppCompat主题(或后代)” - Issue with You need to use a Theme.AppCompat theme (or descendant) with this activity Theme.AppCompat theme (or descendant) with this activity" AppCompat库不包含Theme.AppCompat。 “您需要在此活动中使用Theme.AppCompat主题(或后代)” - AppCompat library doesn't include Theme.AppCompat. “You need to use a Theme.AppCompat theme (or descendant) with this activity” 错误消息:您需要与此活动一起使用Theme.AppCompat主题 - Error Message: You need to use a Theme.AppCompat theme with this activity 扩展活动中的错误您需要使用Theme.AppCompat主题 - error in extend activity You need to use a Theme.AppCompat theme
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM