Tag: android-viewpager

ViewPager first fragment shown is always wrong with FragmentStatePager

I am trying to have the same view pager + tabs design as the PlayStore 5.1.x. Here is my layout : <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”match_parent” android:layout_gravity=”center_vertical|center_horizontal” android:gravity=”center_vertical|center_horizontal” android:orientation=”vertical”> <com.astuetz.PagerSlidingTabStrip android:id=”@+id/tabs” android:layout_width=”match_parent” android:layout_height=”50dp” android:background=”@drawable/background_tabs” /> <android.support.v4.view.ViewPager android:id=”@+id/pager” android:layout_width=”match_parent” android:layout_height=”match_parent” /> </LinearLayout> My Adapter: public class MainPagerAdapter extends FragmentStatePagerAdapter { private ArrayList<FakeFragment> fragments; public […]

ViewPagers in a ListView showing blank list items

[EDIT]: Thank you for all the meaningful answers, the problem is now solved, thank to your help. Similar issue: Android: I am unable to have ViewPager WRAP_CONTENT I’m trying to implement the UI of my app : I want a ListView with a ViewPager in each row. Here are my files : MainActivity.java package com.condi; […]

Android – FAB to hide when navigating between different fragments in a viewpager

I’m trying to do something really simple. I would like the FAB to only appear on one tab in my TabLayout and be hidden when navigating to another tab. So for example, one tab would let you add new items in the FAB, but the next tab would not let you add items. I have […]

Video is not pausing in fragment ViewPager

I am using View Pager with fragment to showing image and video, I am able to show image and video properly but I have problem, when I swipe for video, then video is playing, but I swipe next or previous then video is still playing on just next or previous screen but when I move […]

PagerAdapter class getting called multiple times

I am working on an application which has a ViewPager view in it, I have created a PagerAdapter, which has the view, instantiateItem() method of PagerAdapter is called twice in create() i don’t know why, can anyone help me with this? Here is my code, View PagerView; MyPagerAdapter adapter; ViewPager pager; adapter = new MyPagerAdapter(); […]

how to access the value of edittext inside fragment which is in a viewpager

I am having am mainActivity which consists of 3 fragment activity in a view pager .each fragment consists of edit texts .How to get the value of the edit text when swipe fragment horizontally ? I am trying to do like this.below code public class MainActivity extends FragmentActivity { int value = 0; Context context; […]

Actionbar Sherlock – tabs won't change in landscape when swiping

I have a screen which uses ViewPager + actionbar Sherlock tabs. I have a setOnPageChangeListener set on the pager and it does the following: @Override public void onPageSelected(final int position) { actionBar.setSelectedNavigationItem(position); } This works just fine in portrait mode and even in landscape if I only have few tabs and all the tabs are […]

Fragment doesn't call onSaveInstanceState when swiping ViewPager?

I’m having an issue with the ViewPager where my ListView is loosing it’s scroll position. The state of the ListView can easily be stored and restored using: @Override public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.frag_cool_things, container, false); AdvListView listView = (AdvListView) v.findViewById(R.id.lv0); listView.setOnItemClickListener( mOnListItemClicked ); if (null != […]

ViewPager's Fragments disappear

I’m using DrawerLayout with ViewPagerIndicator, however the last won’t work correctly with the DrawerLayout. Once I open the application, the viewpager is displayed correctly but once I change fragments in the DrawerLayout the ViewPager’s fragments disappear. Here’s my FragmentManager: FragmentManager fragmentManager = getSupportFragmentManager(); switch (arg2) { case 0: contentFragment = new Lebanon(); break; } fragmentManager.beginTransaction() […]

How to use Android ViewPager?

Possible Duplicate: android viewPager implementation Can someone please tell me how I can properly implement ViewPager into my project? I need to know what I can achieve by using it? I am somewhat new to programming and android. Basically I need to use horizontal paging for an app on which I am working on right […]

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