android-viewpager

Update ViewPager's Fragments from another class:

爷,独闯天下 提交于 2020-02-03 02:07:11
问题 Following this question: How to recreate all fragments in ViewPager: I have those classes: public class ViewPagerAdapter extends FragmentPagerAdapter { private List<Fragment> fragments; /** * @param fm * @param fragments */ public ViewPagerAdapter(FragmentManager fm, List<Fragment> fragments) { super(fm); this.fragments = fragments; } /* (non-Javadoc) * @see android.support.v4.app.FragmentPagerAdapter#getItem(int) */ @Override public Fragment getItem(int position) { return this.fragments.get

FragmentStatePagerAdapter first call to getItem wrong with sdk 22-->23 upgrade

痞子三分冷 提交于 2020-02-02 11:09:47
问题 UPDATE 2: Getting rid of all v4 support references fixed it. UPDATE: I started from scratch to see what triggers this behavior. It occurs once I add a check for location permissions. I can't go backwards -- even when I strip out all the permissions code it stays with the incorrectly-bahaving FragmentStatePagerAdapger. I have a FragementStatePagerAdapter that was working just fine for a ViewPager of dynamically created fragments until I changed my compileSdkVersion and target SdkVersion from

Android: limit fragments loading with a viewPager

半城伤御伤魂 提交于 2020-02-02 02:47:06
问题 I have 3 fragments that are managed by an FragmentPagerAdapter, set to a viewPager. I want to load fragments one by one, but when the onCreate method of FragmentActivity is executed, the 2 first fragments are executed (onCreateView method). I have tried to limit fragments loading with the setOffscreenPageLimit method but nothing change. mPagerAdapter = new MyPagerAdapter(super.getSupportFragmentManager(), fragments); pager = (ViewPager) super.findViewById(R.id.tabviewpager); pager

ViewPager inside Fragment with margins and page transformer not rendering correctly

一个人想着一个人 提交于 2020-02-01 03:17:27
问题 I have a viewpager with fragments inside it. I use the code similar to e.g. ViewPager margin in PageTransformer transformations and padding so you can see the faded out edge of fragments on either side of the fragment you are currently viewing. But the problem is when the viewpager is first started, the fragments on either side are not faded and zoomed out. I.e. the transformPage method of my ZoomOutPageTransformer doesn't get called until you start swiping, so the initial off-page right /

How to achieve a ViewPager with previous and next page shown and bigger focused page

旧城冷巷雨未停 提交于 2020-01-31 08:53:31
问题 I'm trying to create something that will display my pages on a viewpager for it to have nice feel and design and I checked out this link which somehow helps and also follow this link on how I can implement it but I ended up with some issues. First is that it won't really work or look that good for devices that runs below API11 (API8 is my target). and Second is that I can't manage to make the focused page to be bigger than the next and previous page. I wanted it look something like this for

ActionBar BUG: List mode navigation not visible after using SearchView

北城以北 提交于 2020-01-31 04:29:06
问题 Project demonstrating this bug: https://github.com/smarek/ActionBar-Navigation-Bug Bugreport on b.android.com : http://code.google.com/p/android/issues/detail?id=51449 I'm currently facing an issue with ActionBar. Let's have a ViewPager+PagerTitleStrip and 3 Fragments. User flow: Open application First Fragment has set navigation mode to NAVIGATION_MODE_LIST Other Fragments has NAVIGATION_MODE_STANDARD All Fragments has options menu item with SearchView Go to second or third and open search

android background image slows down app

百般思念 提交于 2020-01-27 20:44:51
问题 I am using a viewpager to swipe amongst fragments in my app. I define the background in the XML, so android:background="@drawable/bg_final" If I use a simple background color, my app works very smooth. If I use it with this background image, fps decreases and my app becomes only passable. It is not slow, just not so smooth, however on weaker devices it could work laggy. Is it a bad way to apply a background image? The whole image is a 480x800 png with the size of 14.7kB. What might be the

android background image slows down app

心不动则不痛 提交于 2020-01-27 20:35:50
问题 I am using a viewpager to swipe amongst fragments in my app. I define the background in the XML, so android:background="@drawable/bg_final" If I use a simple background color, my app works very smooth. If I use it with this background image, fps decreases and my app becomes only passable. It is not slow, just not so smooth, however on weaker devices it could work laggy. Is it a bad way to apply a background image? The whole image is a 480x800 png with the size of 14.7kB. What might be the

Viewpager pages with different layouts but same fragment class

余生长醉 提交于 2020-01-25 20:04:47
问题 Using a ViewPager, I'm working on a guide that tells the user how to use my app. This is how i currently add/setup the pages: ... private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter { public ScreenSlidePagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { switch (position) { case 0: return new Guide_fragment(); case 1: return new Guide_fragment_2(); case 2,3,4 etc. default: return null; } } ... But this way I have to have a

In the “ActionBarTabsPager” tutorial, getActivity returns null

五迷三道 提交于 2020-01-25 12:09:42
问题 I have successfully implemented the tutorial: http://developer.android.com/reference/android/support/v4/view/ViewPager.html, as a Tab'ed viewpager activity with fragments on each tab. Each Fragment maintains various UI TextFields etc and everything is working fine with the exception of getActivity(), which returns null when called from any of the fragments. UPDATE: Read this, then please see my own answer below that broadens the scope regarding the cause of this error. Continued: BUT, the