ActionBar.selectTab doesn't refresh spinner in

2019-07-04 19:18发布

In an application, I'm using Tabs with the ActionBar, and sometimes I switch tabs programatically using the ActionBar.selectTab() method.

This works well but when the width of the ActionBar is too small, the tabs go in compact mode, and are displayed as a drop down menu. And when I use the ActionBar.selectTab() method, the displayed item in the spinner doesn't change.

Is there an official solution for this or a known workaround ?

2条回答
Fickle 薄情
2楼-- · 2019-07-04 19:34

This is a known bug in Android. Please look at a workaround suggested by Jake Wharton here: and star the issue so it gets fixed

查看更多
再贱就再见
3楼-- · 2019-07-04 19:44

This problem has been asked on ActionBarSherlock github. It seems that this problem also exists on the ICS ActionBar.

It can be avoided with ABS by changing the source as stated in the link. For the native ActionBar, I managed to make a workaround using reflection to access the action bar's dropdown spinner.

查看更多
登录 后发表回答