Tag: android-viewpager

Insert pages in the middle of a FragmentPageAdapter

I’m using a ViewPager from ViewPageIndicator and I need to be able to dynamically insert one fragment in the middle of others. I’ve tried to manage the model with FragmentPagerAdapter and FragmentStatePagerAdapter (both from v4 support code) and the first seems to don’t manage in any way insertion of pages in the middle. And the […]

How to have a parallax effect between 2 ViewPagers?

Background Consider the following scenario: There are 2 viewPagers, each of different width and height, but both have the exact same number of pages. dragging on one should drag the other, so the effect is like a “parallax” effect. same as #2, but for the other viewPager. there is also an auto-switching mechanism between the […]

Android: PagerAdapter's setPrimaryItem() being called more than once

Why is PagerAdapter.setPrimaryItem() called more than once (with the same values) after I select a new page with ViewPager.setCurrentItem(index) ?

Disabling & Enabling Paging In ViewPager in Android

I am using android compatibility package version 4 for displaying pdf pages in my app. I have used PagerAdapter & ViewPager for displaying pdf pages like horizontal scroll view. Now the problem is in paging related stuff.I am able to stop paging by detecting childs inside the viewpager according to this thread android: ViewPager and […]

Precise control over Androids VectorDrawable animations

UPDATE: Solution found! Scroll down for my accepted answer! I want to animate multiple elements of one image and link the animation to ViewPagers position (so multiple elements are morphing or flying in/out depending on the current page being dragged). So, is there a way to precisely control the current frame of the animation? For […]

Sliding tabs inside actionbar tabs

I am trying to implement sliding tabs inside actionBar tabs just like flipboard. So one of the main tabs will have three tabs. Sub-tabs will scroll first and once all tabs get scrolled, then main tab comes into focus and will start scrolling. I am attaching screenshot of flipBoard UI Have anyone done this? Please […]

View translation in sliding a ViewPager

I was reading an example on customizing ViewPager‘s sliding page animation that entails translating the page(View) to a certain amount. The example is from the docs. Specifically, it is about an implementation called ZoomOutPageTransformer that can be set on a ViewPager through setPageTransformer() to customize how the page slides(incorporating a zoom animation in it). This […]

Fragment as a singleton in Android

General Question Can I define Fragments as Singletons? Specific question In my application I have one ‘FragmentActivity’ with a FragmentPager which has two Fragments, FragmentA and FragmentB. I defined the fragments as Singletons in the FragmentA extends Fragment class: private static instance = null; public static FragmentA getInstance() { if (instance == null) { instance […]

Text in PagerTabStrip not displayed upon 1st view

I have the following simple setup: swipeable.xml <LinearLayout android:id=”@+id/content_frame” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical” > <include layout=”@layout/toolbar” /> <android.support.v4.view.ViewPager android:id=”@+id/pager” android:layout_width=”match_parent” android:layout_height=”match_parent” > <android.support.v4.view.PagerTabStrip android:layout_width=”match_parent” android:layout_height=”wrap_content”/> </android.support.v4.view.ViewPager> </LinearLayout> Activity: public class InfoActivity extends ActionBarActivity { private static final int[][] KEYS = { { R.string.usage, R.string.usage_text }, { R.string.data_protection, R.string.data_protection_text }, { R.string.impressum, R.string.impressum_text } }; @Override protected […]

Map v2 SupportMapFragment inside Viewpager

Background I have successfuflly added the new map api v2.0 to a ViewPager and the map loads fine. I am using the FragmentViewPager. I run into trouble however when trying to add markers as I cannot get the Fragment by tag as the ViewPager I am using is from the compatibility library and defined in […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.