如果再次单击当前选项卡,是否重新加载片段? [英] Reload fragment if current tab is clicked again?

查看:56
本文介绍了如果再次单击当前选项卡,是否重新加载片段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要在我的Android应用程序中导航,请使用 ActionBar.NAVIGATION_MODE_TABS .其中一个标签中的内容变化非常快.

To navigate in my Android application I use ActionBar.NAVIGATION_MODE_TABS. The content in one of the tabs is changing quite fast.

用户应该可以通过再次触摸操作栏中的相同项目来重新加载标签.当前,选项卡内容由 ViewPager 缓存,因此如果用户单击选项卡,则不会刷新.

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.

即使已显示当前选项卡,也会触发 TabListener.onTabReselected(...),这可能是解决方案的起点.

As TabListener.onTabReselected(...) is fired even if the current tab is already shown, it may be the starting point of a solution.

推荐答案

即使已显示当前选项卡,也将触发TabListener.onTabReselected(...),这可能是解决方案的起点.

As TabListener.onTabReselected(...) is fired even if the current tab is already shown, it may be the starting point of a solution.

onTabReselected()上,在现有片段上调用一个导致其刷新其内容的方法.

On onTabReselected(), call a method on your existing fragment that causes it to refresh its contents.

这篇关于如果再次单击当前选项卡,是否重新加载片段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆