android-viewpager

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

三世轮回 提交于 2019-12-21 03:53:34
问题 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, it never states when an overriding method should consider the position to be changed. Does it mean the position is different to the position it was in last time the

Highlight or underline selected TabPageIndicator

半世苍凉 提交于 2019-12-21 03:48:37
问题 I have a dualpane on a tablet-sized landscape layout and I'm using fragments. On the left I have a fragment with a listview. When a click occurs on one of the item list the right fragment loads the detail. In the layout of the right (detail) fragment there is a com.viewpagerindicator.TabPageIndicator and a android.support.v4.view.ViewPager. The ViewPager will load 2 elements and each one has its com.viewpagerindicator.TabPageIndicator . I'm trying to highlight or underline the selected tab

A custom Android View with 4-direction swipe gesture

℡╲_俬逩灬. 提交于 2019-12-21 03:01:19
问题 I am working on an Android App which shows a series of cards. Each card almost takes the whole screen. I want the user to be able to view the previous and next cards by swiping left and right and for that ViewPager is working nicely. However I also want the user to be able to swipe up and down a card to like/dislike a it. The swipe up/down gesture should move up/down the card according to the user's hand gesture. After a card is swiped up/down, it should be removed from the list of cards. I

Showing specified page when view pager is first created

余生颓废 提交于 2019-12-21 02:57:17
问题 I have a fragment that contains a ViewPager . This ViewPager is backed by a PagerAdapter that uses a Cursor . The cursor is managed by LoaderCallbacks . I'm using the v4 support libraries here. What I want is to create the fragment and have the view pager showing a specified page, rather than starting at page 0. I know that ViewPager has a setCurrentItem() method, but the data may not yet be loaded when the ViewPager is created. What I need is to listen to the adapter for data set changes,

Use Single Fragment in Multiple tabs of ViewPager

半城伤御伤魂 提交于 2019-12-21 02:52:09
问题 I am using ViewPager to slide left and right, I have also added the tabs, The number of tabs is depends on the server data, So, I cannot make the number of tabs as Fixed. To do this I used only Single Fragment and a RecyclerView to display JSON Data in the recyclerView. When First app launches, the data which should be shown in 2nd tab is getting displayed in 1st Tab itself. After I swipe to 3rd Tab and come Back again to 1st Tab, then the data is displaying correctly. It is as same as

ViewPager PageTransformer with Support Library v13

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-21 02:43:44
问题 My application uses Android's ViewPager with a FragmentStatePagerAdapter and it only needs to support Android 4.x or above. I'm using the v13 support library for the ViewPager so I don't need to deal with SupportFragments, I just have to use Android.app.Fragment . Everything works as expected, but now I'm trying to add a PageTransformer to my ViewPager and I'm running into problems. ViewPager.setPageTransformer(bool, PageTransformer) isn't recognized as a method, and PageTransformer isn't

Determine which fragment currently visible in ViewPager

独自空忆成欢 提交于 2019-12-21 01:21:52
问题 I've ViewPager which I'm using for displaying few fragments, I also have TextView on my FragmentActivity . I need to change text in TextView depending on which fragment is currently selected in ViewPager . The problem I've faced: ViewPager have some caching mechanism, it instantiates fragments before they are really visible for user, for example when I select second page in ViewPager fragment on third page also created. What is more I can't determine inside fragment is this fragment visible

Determine which fragment currently visible in ViewPager

笑着哭i 提交于 2019-12-21 01:21:42
问题 I've ViewPager which I'm using for displaying few fragments, I also have TextView on my FragmentActivity . I need to change text in TextView depending on which fragment is currently selected in ViewPager . The problem I've faced: ViewPager have some caching mechanism, it instantiates fragments before they are really visible for user, for example when I select second page in ViewPager fragment on third page also created. What is more I can't determine inside fragment is this fragment visible

Weird issue refreshing ViewPager with new content:

不羁的心 提交于 2019-12-20 20:16:14
问题 I receive data from a web service that is parsed into an object in the Application class, this object which in my case is a Report class contains a list of Tabs that should populate the ViewPager . So this Report is stored in the currentReport parameter in the Application class. Each tab should be a page in the ViewPager . So for the first time when I receive the data and parse it, all works perfectly and the View Pager is populated with the correct data and presents it. My problem starts

Weird issue refreshing ViewPager with new content:

a 夏天 提交于 2019-12-20 20:16:10
问题 I receive data from a web service that is parsed into an object in the Application class, this object which in my case is a Report class contains a list of Tabs that should populate the ViewPager . So this Report is stored in the currentReport parameter in the Application class. Each tab should be a page in the ViewPager . So for the first time when I receive the data and parse it, all works perfectly and the View Pager is populated with the correct data and presents it. My problem starts