Android actionbar spinner selected item, subtitle and dropdown list

后端 未结 2 1755
别跟我提以往
别跟我提以往 2021-01-31 11:29

How can I make spinner in action bar to have different item as selected (shown in the action bar top) then the one in the drop down list? Example is google mail with spinner in

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-31 12:11

    it might be a bit too late, but the tutorial with commented codes can be found on the Android developer website: http://developer.android.com/guide/topics/ui/actionbar.html#Dropdown

    the basics is that during the activity OnCreate you have to set it to be a list:

          getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    

    and then create a spinner adapter and a couple of callbacks just like you would do with a normal spinner.

    hope it helps

提交回复
热议问题