在视图寻呼机更换片段 [英] Replacing a fragment in a view pager

查看:104
本文介绍了在视图寻呼机更换片段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到一个解决办法simular这 http://stackoverflow.com/a/13925130/1634451 但海报没有解释R.id.products_list_linear是什么。我试图设置R.id.products_list_linear作为我的LinearLayout,因为我试图取代片段的ID。但是,这只是覆盖在彼此的顶部2片段。我是pretty确信,我需要得到在viewpager容器的id,但我不知道如何得到这个ID。

I am trying find a solution simular this http://stackoverflow.com/a/13925130/1634451 but the poster didn't explain what R.id.products_list_linear is. I tried to set R.id.products_list_linear as the id of my linearlayout for the fragment i am trying to replace. But that just overlays the 2 fragments on top of each other. I am pretty sure that i need to get the id of the container in the viewpager but i don't know how to get this id.

编辑:
为了澄清我试图与另一个我的code视图寻呼机替换片段看起来几乎完全一样的答案我张贴,但是当我做了R.id.products_list_linear我的片段,我试图取代布局。我只是更换片段被覆盖在一个我试图取代

To clarify i am trying to replace a fragment in a view pager with another my code looks almost exactly like the answer I posted but when I make R.id.products_list_linear the I'd of the fragment I am trying to replace layout. The fragment I am replacing just gets overlaid on the one I am trying to replace

推荐答案

我结束了一个不同的方法,很好地制定了我去。我用了一个ViewSwitcher在viewpager片段。

I ended up going with a different approach that worked out nicely for me. I used a ViewSwitcher for the fragment in the viewpager.

这篇关于在视图寻呼机更换片段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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