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