Extending Activity or ActionBarActivity

情到浓时终转凉″ 提交于 2019-12-06 14:04:40

You extend ActionBarActivity if you'll be using the ActionBar on api s lower then 11 for support for api >=7 check out http://developer.android.com/guide/topics/ui/actionbar.html

Also it can be a source of confusion but when you use ActionBarActivity your theme must be a child of one of Theme.AppCompact descendents such as

 <style name="MyTheme" parent="Theme.AppCompact">
    <item name="android:colorPrimary">@color/accent_1</item>
    <item name="android:colorPrimaryDark">@color/accent_dark</item>
    <item name="android:colorAccent">#f00</item>

    <item name="colorPrimary">@color/accent_1</item>
    <item name="colorPrimaryDark">@color/accent_dark</item>
    <item name="colorAccent">#f00</item>

</style>

The non prefixed android:provide the Material theme compatibility that you talked you want for users of < API 21 (Lollipop)

Extend ActionBarActivity and use Theme.AppCompat - so your style theme will be this only values-21

<style name="AppTheme" parent="Theme.AppCompat">

values

<style name="AppTheme" parent="Theme.AppCompat">

try this and let me know if it works

NOTE1: ive not tried it, and im conjuring from a wide range of thoughts

ps; yes ive read the documentation..

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!