[Seeking advice! ! Fragment ViewPager related issues]
posts by Remember2 edited 2013-12-16 18:28:05
want to achieve results similar to the micro-channel, the content of the tab click Footer followed changes the entire page, but the page does not require a sliding switch (toggle switch the page, including gestures and clicks the tab to switch Footer The default ViewPager is a gesture of switching and click Footer tab switch has a sliding animation)
Asked questions I encounter the following Issue 1. With ViewPager, prohibiting gesture slide switch, a search online there are many possible answers, but how to stop the slide switch when clicking tab, but did not find the right answer, but also please the great God who enlighten
Issue 2. It was also said that since the pages do not need to slide, with ViewPager only waste resources, can be used directly Fragment, but Fragment understanding, stay on FragmentBasic Demo official offer, do not know how to achieve these effects,
Question 3. Regardless of when you first click on the question ViewPager tab page will slide switch, you want to fill ViewPager There are two ways, one in combination with Fragment; a direct filling Activity, I realize the current state of the Fragment method succeeded, but the direct filling activity but always for similar normal_headerbar.setVisibility (View.GONE); statement reported null pointer exception (under normal circumstances activity normal start), search for a long time did not get an answer. There is two ways filling ViewPager What is the difference and feature? Which is better? ?
Reply: Landlord, in which case you must abandon the use ViewPager. Implementation: Footer following a few keystrokes instead of a custom ActionBar (android: showAsAction = "always"), click the tab to show the response of Fragment. If you can not achieve the effect you want, Footer directly with a LinearLayout, there are four buttons can also be simulated to achieve a similar effect, to see how the landlord planning now! Reply:
Someone finally responded, a start is to use four buttons do, but found too much trouble to manage each page, such as: To own cache data, otherwise data will jump every time the page is reloaded; do so, in fact, four pages, but I want to achieve the effect of a page is divided into four sections, or jump issues page ActionBar not compatible Android3.0 less, looks like you can use FragmentTabHost, too many ideas to achieve it. . Have a big head Reply:
What do you want here is fast, does not need and do not need to load every time the effect of the sliding switch, then you masked ViewPager the onTouchEvent, return true to consume, not passed down. viewpager then set a ViewPager.OnPageChangeListener listener (mainly achieved onPageSelected method), mViewPager.setOnPageChangeListener (ViewPager.OnPageChangeListener listener ....)
Reply:
Landlord, in which case you must abandon the use ViewPager. Implementation: Footer following a few keystrokes instead of a custom ActionBar (android: showAsAction = "always"), click the tab to show the response of Fragment. If you can not achieve the effect you want, Footer directly with a LinearLayout, there are four buttons can also be simulated to achieve a similar effect, to see how the landlord planning now!
Someone finally responded, a start is to use four buttons do, but found too much trouble to manage each page, such as: To own cache data, otherwise data will jump every time the page is reloaded; do so, in fact, four pages, but I want to achieve the effect of a page is divided into four sections, or jump issues page ActionBar not compatible Android3.0 less, looks like you can use FragmentTabHost, too many ideas to achieve it. . Have a big head
What do you want here is fast, does not need and do not need to load every time the effect of the sliding switch, then you masked ViewPager the onTouchEvent, return true to consume, not passed down. viewpager then set a ViewPager.OnPageChangeListener listener (mainly achieved onPageSelected method), mViewPager.setOnPageChangeListener (ViewPager.OnPageChangeListener listener ....)
Find the answer, I want to use TabHost effect can be achieved, or would like to thank you for your answer
No comments:
Post a Comment