actionbar setnavigationmode deprecated

不羁的心 提交于 2019-12-04 03:38:39

问题


Hi I'm making an app in which I plan on showing floor & category wise listing of stores inside a mall.

Below snap show an activity showing floor wise listing of stores

I was thinking of adding a spinner in the ActionBar showing "by Floor" and "by Category" as options. Clicking on "by Category" would arrange the stores according to the category in which they belong. After googling a bit I found

getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

would be apt but now I see that its deprecated, putting it as an action item in the activity menu doesn't look like a very good idea. Any suggestions ?


回答1:


setNavigationMode it's deprecated because on Lollipop it has being replaced by a new paradigm.

You have two options, at least:

  1. Ignore it unless you are targeting 21+ API and developing only for Lollipop.

  2. Use AppCompat; samples here: https://github.com/google/iosched

Personally, I went for option 1.




回答2:


The Google I/O 2014 Android App contain what you need

SlidingTabLayout.java ,check out here

and the SlidingTabStrip.java

there are two files could implement what you show up there.

more document about this style at here



来源:https://stackoverflow.com/questions/27626761/actionbar-setnavigationmode-deprecated

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