Tag: android-viewpager

Replacing Fragment in ViewPager shows blank screen?

I’m having a lot of trouble getting Fragments to work with Tabs/Swiping. I have one activity and two Fragments, one which has a ListView. What I want is when I swipe from fragment 1 to the fragment with the ListView, to refresh the ListView or if possible recreate the second fragment…. What I am trying […]

ViewPager inside ListView

Is there a way to add a viewpager as a listview item? I want to add it as a “header” on top of my listview before all real list items follow. I tried using addHeaderView() or declaring multiple view types in my list adapter, however, the viewpager never shows up whatever way I try. Has […]

Change Color TabSelector on v4 ViewPager

Is it possible to change color of selected tab on v4 ViewPager? I need to use v4 ViewPager, but I don’t find any source to customize it. Just to clarify I need to change the blue color to another one:

Android Parallax Effect and View Pager

I’m trying to achieve a parallax effect in my application. I have a FragmentActivity that implements the OnPageChangeListener interface and listens to my ViewPager scrolling events. To achieve this effect in my XML I have a LinearLayout behind all the other views with my background, and I move it in the onPageScrolled callback. If I […]

How can I disable all touch events on all children of a ViewGroup?

I’ve got a FrameLayout container containing many things (including ScrollView, WebView, ViewPager…). I would like to be able to trigger the onClick event on this container, but it seems that some of ScrollView, WebView and ViewPager intercept the touch event, because the onClick event is only triggered when I click on the parts of the […]

How to replace Fragment inside ViewPager, using PagerAdapter?

My problem I am using a ViewPager to display fragments inside a FragmentActivity. ViewPager gets fragments from the attached FragmentPagerAdapter. mViewPager = (ViewPager) findViewById(R.id.view_pager); mAdapter = new HomePagerAdapter(getSupportFragmentManager()); mViewPager.setAdapter(mAdapter); Suppose ViewPager has 3 fragments to display: Fragment1, Fragment2, Fragment3. Fragment1 is a grid fragment and displays a grid. Fragment2 and Fragment3 have their own content […]

ViewPager with multiple fragment instances of same class

I am trying to create a ViewPager which contains 5 fragments. 5 fragments “container”, so each of them contain 2 fragments. The 4 first fragments have the same layout and belong to the same class. The fifth is from an other class, and there is no problem with that one. The problem is that when […]

How to update view pager item TITLE dynamically

I have a simple messaging application module. In which, there are two swipable tabs. Received and Sent. Let us say I have 20 messages out of which 10 are unread. So what I am doing is showing the tabs as Received – (10). Now when I read the message, it marks the message as read. […]

How to align active tab center in android Sliding Tab Layout

I have 12 items in android sliding tab layout + view pager. While sliding from left to right, selected tab should be center same as play store. Please help me how to do that. In my application active tab is always left of the screen.

When should getItemPosition consider changes of an item's position?

The documentation for the method getItemPosition in Android’s PagerAdapter class states that it is: Called when the host view is attempting to determine if an item’s position has changed. This method is supposed to be called to indicate whether or not an item’s position in the group of items for that adapter has changed. However, […]

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