Blog icon indicating copy to clipboard operation
Blog copied to clipboard

ActionBar

Open alwaystest opened this issue 9 years ago • 0 comments

ActionBar

标签(空格分隔): Android


之前一直没有搞明白android.app.ActionBarandroid.support.v7.app.ActionBar的区别。

在StackOverflow上只看到过getActionBar()getSupportActionBar()有区别。后者获取到的是android.support.v7.app.ActionBar。于是理解成了只要版本需要向下兼容之前的系统,就需要使用Support包的东西,如果我只支持高版本的系统,就没有必要使用兼容包了,然而这个想法是错误的。

实际情况在API文档里面写的很清楚:

  • android.app.ActionBar

    the action bar appears at the top of an activity's window when the activity uses the system's Holo theme (or one of its descendant themes)

  • android.support.v7.app.ActionBar

    when the activity uses the AppCompat's AppCompat theme (or one of its descendant themes).

主题不同,里面使用的ActionBar类型不同,而且这俩货还没有继承关系。

查看API文档很重要,StackOverFlow再牛也需要搜索到完全对应的问题才能看到相关的答案。

alwaystest avatar Dec 09 '15 12:12 alwaystest