问题
To navigate in my Android application I use ActionBar.NAVIGATION_MODE_TABS
. The content in one of the tabs is changing quite fast.
A user should be able to reload the tab by touching the same item in the action bar again.
Currently the tab content is cached by ViewPager
and therefore not refreshed if a user clicks on the tab.
As TabListener.onTabReselected(...)
is fired even if the current tab is already shown, it may be the starting point of a solution.
回答1:
As TabListener.onTabReselected(...) is fired even if the current tab is already shown, it may be the starting point of a solution.
On onTabReselected()
, call a method on your existing fragment that causes it to refresh its contents.
来源:https://stackoverflow.com/questions/12876106/reload-fragment-if-current-tab-is-clicked-again