简体   繁体   English

在“滑动”选项卡操作栏中启动新片段

[英]Start new fragment in Swipe tab action bar

I am building my apps with swipe tab action bar. 我正在使用滑动选项卡操作栏来构建我的应用程序。 I manage to build that but I need to start a new fragment when user press something from one of the tab, anyone can help me what can I do? 我设法建立它,但是当用户从选项卡之一中按某些东西时,我需要开始一个新片段,任何人都可以帮助我该怎么办?

As you are in a fragment 当你处于碎片中

The following code is what you need! 以下代码是您所需要的!

YourFragment openfragment= new YourFragment();
this.getFragmentManager().beginTransaction()
.replace(R.id.Layout_container, openfragment,TAG_FRAGMENT)
.addToBackStack(null)
.commit();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM