ActionBar.selectTab doesn't refresh spinner in compact mode

天大地大妈咪最大 提交于 2019-12-10 19:23:53

问题


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 ?


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/11030744/actionbar-selecttab-doesnt-refresh-spinner-in-compact-mode

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