android-viewpager

Having vertically scrolling pages in ViewPager

对着背影说爱祢 提交于 2019-12-20 19:39:41
问题 This may be obvious and a completely unneeded post but I had been having quite an issue resolving a way to allow vertical scrolling functionality on pages in a VewPager and there were very few resolutions coming across google and even here. I found some claiming to resolve the issue but they seemed to be extended and convoluted. So for those who may be searching for the same issue heres the solution. With this (and you will want to make bigger strings than what I wrote here) you will be able

Android View onSaveInstanceState not called

[亡魂溺海] 提交于 2019-12-20 18:00:41
问题 I am working with CustomView which extends some Android view like FrameLayout. In my layout I use a ViewPager with a custom PagerAdapter. The problem is that my View did not restore it's state when the fragment is re-attached to the ViewPager/Activity. For example, I have three fragments, if I swipe to the last one and come back to the first, the ScrollView is not where I let it : it's back to default, on top. I know that with a PagerAdapter, not all fragment are active on the same time,

Communication objects between multiple fragments in ViewPager

时光怂恿深爱的人放手 提交于 2019-12-20 17:36:18
问题 I have 5 fragments in ViewPager used to fill business object with several fields step by step, in each step some of those fields will be set. I've read many articles about communication between fragments but I'm not feeling comfortable the way others preferred, so after thinking about HOW should I do this in my case, finally I start thinking to use singleton model object which all fragments can easily access to its fields and fill them in specific steps. As I'm new to android I want to hear

java.lang.IllegalArgumentException: The observer is null

喜你入骨 提交于 2019-12-20 14:12:08
问题 A user of one of my apps reported this error. I'm confused as to what it means an how to fix it. After a bit of googling...still no luck. Anyone seen this before or know how to fix it? java.lang.IllegalArgumentException: The observer is null. at android.database.Observable.unregisterObserver(Observable.java:59) at android.widget.BaseAdapter.unregisterDataSetObserver(BaseAdapter.java:42) at android.widget.HeaderViewListAdapter.unregisterDataSetObserver(HeaderViewListAdapter.java:256) at

SearchView with multiple fragments using viewpager in android

折月煮酒 提交于 2019-12-20 12:32:29
问题 I want to implement SearchView with multiple fragments present in a viewPager. All fragemnts contains lists and I want to filter those lists and create a new ListView which has categorization of results based upon which fragment it belongs to. But my searchView is not working with one fragment. Here is my main activity: package com.codeon.directory; import android.app.SearchManager; import android.content.Context; import android.os.Bundle; import android.support.design.widget.TabLayout;

Viewpager with dynamic height not working (always use the first fragment's height)

百般思念 提交于 2019-12-20 10:46:34
问题 I have followed this and that answers, i also found this link. I use those resources to do trial & errors. Now my custom ViewPager successfully measure its content, but only the first one displayed . FYI, my ViewPager holds some complex views, like ExpendableListView - thats why none of the code in those resources working perfectly, i need to modify the code by myself. I have 4 fragments (content), so i use pager.setOffscreenPageLimit(3); This is my custom ViewPager : public class

ViewPager inside fragment issue

删除回忆录丶 提交于 2019-12-20 10:44:19
问题 I'm having problem with view pager which is inside of some fragment. To work with view pager I'm using FragmentPagerAdapter. And sure I'm getting java.lang.IllegalStateException: Recursive entry to executePendingTransactions exception when trying to run my app. Most people say it's impossible to have FragmentPagerAdapter inside other fragment, so I'm sorry if this question is invalid. I was just hoping that maybe someone has some fresh ideas about this problem and its possible solution. P.S.

Endless adapter for ViewPager

左心房为你撑大大i 提交于 2019-12-20 10:38:45
问题 I've been using CWAC's EndlessAdapter to achieve infinite scrolling on ListViews. I'd like to accomplish the equivalent for a ViewPager. Unfortunately, PageAdapter and ListAdapter do not share the same common base class. What's the best way to go about this? Does a library exist that already handles this? 回答1: What's the best way to go about this? Add "endless" logic to your own implementation of PagerAdapter . Or, if you wish, try creating a decorating PagerAdapter , the way that

Android ViewPager when swiping on last screen

久未见 提交于 2019-12-20 10:37:17
问题 Im having trouble figuring out how to capture a swipe event on the last page of a view pager. Basically the requirement is that when the user is on the last page, and they try to swipe to get to the next page, the activity should close. I've tried doing this onPageScrolled but I cant seem to differentiate a left or right swipe when in there. When on the last page, the user should still maintain the functionality to move to the previous page. So basically the case is When on last page if swipe

Non-Scrolling Fragment in a ViewPager inside CoordinatorLayout

若如初见. 提交于 2019-12-20 10:35:03
问题 I am using a ViewPager in a CoordinatorLayout (from latest version of Design Library) in an Activity. Some fragments for this ViewPager have layouts such as RecyclerView or NestedScrollView, but some just cannot scroll given their small content. <android.support.design.widget.AppBarLayout android:id="@+id/tabanim_appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/MyTheme"> <android.support.v7.widget.Toolbar android:id="@+id/tabanim_toolbar"