Questions tagged [android-viewpager]

ViewPager.setcurrentItem( ) freezes ui

The ViewPager is a widget for Android that makes possible displaying different views (or fragments) side by side allowing the user to swipe between them. ViewPager was released as part of the Compatibility Package revision 3 and works with Android 1.6 upwards. ViewPager is a ViewGroup and works in a similar manner to AdapterViews (like ListView and Gallery).

Official Documentation

10802 questions
4
votes
3 answers

Android: direct scrolling/ displaying a particular page in ViewPager on button click

I am trying to display a particular page of a ViewPager on button click. It is working but scrolling to that particular page is not smooth i.e. suppose I am at page no. 1 but if I want to go to page no. 5, other pages 2,3,4 also scrolls. I just want…
4
votes
2 answers

First viewpager page blank

I have a problem that relates to Android's ViewPager. I am currently attempting to implement a VerticalViewPager (though that is not relevant to the problem as this same problem occurs with a normal ViewPager) with a custom PagerAdapter that gets…
user2525981
  • 159
  • 1
  • 3
  • 10
4
votes
1 answer

How to deal with FragmentPagerAdapter reusing Fragments?

So, I'm trying to use a ViewPager from Android's support v4 library, but there's some serious issues with how it (or FragmentPagerAdapter) deals with Fragments. For instance, I subclassed FragmentPagerAdapter to do the following: public class…
Alex
  • 1,103
  • 1
  • 11
  • 24
4
votes
2 answers

Can't change container ID of fragment

I have a working app which I'm trying to optimise for use on tablet's by inflating a different layout as per the Android documentation. The issue I have is that when in portrait orientation, my view is populated by a ViewPager, and my two important…
Karl
  • 3,394
  • 2
  • 22
  • 31
4
votes
3 answers

How can I set ViewPager layoutParams programmatically?

I have the following code but I get an exception java.lang.ClassCastException: android.support.v4.view.ViewPager$LayoutParams cannot be cast to android.view.ViewGroup$MarginLayoutParams protected void onCreate(Bundle savedInstanceState) { …
124697
  • 22,097
  • 68
  • 188
  • 315
4
votes
0 answers

ViewPager inside Fragment doesnt show despite using getChildFragmentManager() when constructing FragmentPagerAdapter

I have a viewpager inside fragment. I would like to use FragmentPagerAdapter to swipe between fragments inside my viewpager. public static class MyFragmentPagerAdapter extends FragmentPagerAdapter { public MyFragmentPagerAdapter(FragmentManager…
4
votes
2 answers

After rotation, fragment transaction gives IllegalStateException

I have an issue with Fragments and BroadcastManager. In my application I switched to one main activity and use the new NavigationDrawer. All content is contained in fragments. One Fragment (Searching for users) contains two tabs (Search By Name,…
4
votes
1 answer

Prevent ViewPager from always instantiating Fragment at position 0?

I'm using a FragmentStatePagerAdapter and ViewPager, and the default starting page is 0. I want mine to start on some arbitary page, say 5. This is how I display my ViewPager: viewPager.setAdapter(adapter); viewPager.setCurrentItem(viewNumber,…
4
votes
1 answer

ViewPager - Infinite Scroll?

I need to show either text or images in the screen. The text or images (total 10 for one request) are fetched from my server through HttpClient. when the user swipes to the right and reaches 8th slide I need to get the next set of 10 text or images…
Naveen
  • 1,040
  • 4
  • 15
  • 38
4
votes
1 answer

ViewPager won't swipe to left when swiping over an EditText

I have a ViewPager containing EditText fields (1 per page). When I scroll to the left, the swipe gesture in consumed by the EditText and the page won't change. However when I swipe to the right the swipe gesture is intercepted by the ViewPager as I…
znat
  • 13,144
  • 17
  • 71
  • 106
4
votes
0 answers

android viewpager inside another viewpager

I'm trying to have a viewpager with few views (let's say 5?) and in one of the views (let's say 3rd view?) I have to put another viewpager so after searching for a while, I've come up with some questions which I couldn't get the exact answer for my…
4
votes
3 answers

ViewPager skip views on return leaving blank

I'm making an app with 4 main Views. I want that all of them stay on a LIST menu on top (That's ok for now). Using Fragments, I have the ability to change the view without actualy going to other activity, but since one of my Views have a ViewPager,…
Ivan Seidel
  • 2,394
  • 5
  • 32
  • 49
4
votes
1 answer

FragmentPagerAdapter and FragmentStatePagerAdapter

I am currently thinking which implementation of PagerAdapter should I use. I've got dilemmas connected to both of them. Let me show you what are these. 1# FragmentPagerAdapter Works fine, It creates new instances of fragments when none previous…
4
votes
1 answer

How to implement a Swipe event to View Flipper in a ViewPager?

How can I pass swipe events to viewflipper inside a view pager. View fliper will swipe in vertical direction is this possible? or I have to use view pager inside a view pager with inside view pager in vertical direction swipe. Thanks in advance
4
votes
1 answer

Android Scrollable Tabs + Swipe state when swiping

I'm trying to make an application with multiple Tabs. For each tab I'm using different fragments. And when I leaf through tabs the information in them is changing. How can I save the state of each tab when swiping? Code for…