Home » Android » android – Action bar list navigation + tab navigation – Position of spinner is not at left most

android – Action bar list navigation + tab navigation – Position of spinner is not at left most

Posted by: admin May 14, 2020 Leave a comment

Questions:

According to Jake as in Android layout with action bar and tabs, we decide to follow his 2nd suggestion.

Use tab navigation in the action bar and set a custom view with a Spinner

Together with IcsSpinner from ActionBarSherlock itself, we manage to make it work in Gingerbread and ICS both.

However, we still suffer the following problem, during landscape mode.

enter image description here

Note, the spinner (“Portfolio 1”) is in between PORTFOLIO tab and search icon. What we want is, the spinner is at the left side of WATCHLIST tab.

Is there anything we may try out?

Thanks.

How to&Answers:

You can set custom view for your action bar, user RelativeLayout to put your spinner at left side of “WATCH LiST”

in java code: actionBar.setCustomView(R.layout.custom_actionbar_layout)

Answer:

a very late answer, but this is possible. You just have to replace (programatically) the view that is pointed by android.R.id.action_bar_title with a Spinner. I wrote a blog about it. Here’s the link