Pagerslidingtabstrip is applied in fragment,fragment in the bottom menu, Viewpager disappears when switching the bottom

Source: Internet
Author: User

Today in the development of a problem, I use the framework is the bottom menu four button +fragment, and then the home page fragment applied Pagerslidingtabstrip,pagerslidingtabstrip is used viewpager+ tab combination to click on the switch page or swipe to switch the menu, so that I want to achieve the function, but when I switch between the bottom menu, Pagerslidingtabstrip in the Viewpeger disappeared, how is this generated? The official demo has not been combined to use, so there is no problem, now after the combination of problems came out, I swapped with a few methods are not resolved, and later in the process of detection found this problem.

The original demo was used in activity, so the usage is as follows:

Noscrollpager.setadapter (New Tabseclectadapter (Getsupportfragmentmanager (), titles));

Pagerslidingtabs.setviewpager (Noscrollpager);

Now I am using to fragment, fragment is not Getsupportfragmentmanager () This method, so then follow the hint to replace the Getfragmentmanager (), This code is not wrong, the initialization comes in when there is no problem, but when I repeatedly switch the bottom menu, and then return to the main page, the Viewpager disappeared, after the multi-troubleshooting, will change the problem here to solve

Noscrollpager.setadapter (New Tabseclectadapter (Getchildfragmentmanager (),

Arrtitles));

Pagerslidingtabs.setviewpager (Noscrollpager);

This problem solved, in fact, this problem is also I inadvertently exposed, if at that time directly replaced Getchildfragmentmanager (), this problem will not come out, but do not come out also let me find this problem, so usually in the problem if there is, everything in the change , and then I found a blog, the same problem as mine, if I do not understand the narrative, you can refer to this blog, Bo Master also attached pictures, I because of the current project reasons, inconvenient out of the picture, still in the confidential stage, hope understanding!

Reference Blog: http://blog.csdn.net/mybook1122/article/details/24003343



This article is from the "Suck on self-renewal" blog, please be sure to keep this source http://wyong.blog.51cto.com/1115465/1629791

Pagerslidingtabstrip is applied in fragment,fragment in the bottom menu, Viewpager disappears when switching the bottom

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.