Android: change tab order/position in TabWidget
In my Android TabWidget, I would like to be able to change the index of a tab such that the order or position of the tab is changed relative to the other tabs. I don't see a way to do this in the documentation. Anyone have any ideas?
I have a scrolling tab bar with the last tab on the right labeled with "+". The user clicks this to create a new tab. But the new tab is always being created to the far right and I want to in开发者_JAVA技巧sert the new tab just to the left of the "+" tab.
Have a look at TabHost.java. You'll most likely need to roll your own TabHost and alter addTab to take an index and add it accordingly.
Can you extend the TabHost and add your own implementation to addTabWithIndex(). There are many datastructures inside TabHost which are private so extending might not entirely resolve your issue.
精彩评论