Questions tagged [android-viewpager]
ViewPager.setcurrentItem( ) freezes ui
10,735
questions
0
votes
0
answers
8
views
Display ImageButton on last slide of viewpager
I'm trying to have a button appear only on the last page of a viewPager. I have the working button but it is displaying on all the pages instead of only the last page. I want to have it visible only ...
0
votes
0
answers
26
views
Jetpack Compose - Nested Scroll with ViewPager using AndroidView
Here's my situation:
I have a screen with a CollapsingToolbarScaffold and I need to implement a (not compose, so I can't use HorizontalPager) ViewPager on this screen. Each ViewPager page is a list ...
-2
votes
0
answers
28
views
Can I create dot indicator using ViewPager2 without image slider [Android-Kotlin]?
I am developing an android application for my project, and I want to create a form that contains EditText and Radio Group fields. However, I want the fields to be in two separate pages interconnected ...
0
votes
0
answers
11
views
Trying to fetch data from a JSON file and pass the data into fragment, but get an error
I am new to Kotlin and Android Studio and I am tasked with creating a tab layout with 3 tabs and with view pager and fragments. Each fragment will have a list of songs from different genres: Rock, Pop,...
0
votes
1
answer
44
views
How can I move two viewpager2 synchronously?
I have a layout design that looks like the drawing below. When I move the viewpager2 below, I want the top viewpager2 to move synchronously. the solutions i found on the internet didn't work
...
0
votes
2
answers
25
views
How to pause a fragment in ViewPager + TabLayout when a different tab is selected?
Right now I have a tablayout with a ViewPager + adapter below it. I want to pause a fragment when a different tab is selected (not destroy/pop it, just pause it) and resume it when the fragment's tab ...
0
votes
1
answer
21
views
Type mismatch: inferred type is ViewPagerAdapterS but PagerAdapter? was expected
i am trying to implement viewpager and tablyout in android studio using kotlin
i have tried fragmentpageradapter but it is not longer used
this is the adapter
package com.example.pgm
import androidx....
0
votes
0
answers
9
views
menu items not showing on Actionbar in Viewpager tabbed layout
I want to display menu items on tabbed layout. In my activity I have a ViewPager with fragments in my Android app. I want to show Action Bar menu item depending the fragment of the ViewPager.So I have ...
0
votes
0
answers
16
views
NullPointerException:Attempt toread from field 'androidx.viewpager2.widget.FakeDrag androidx.viewpager2.widget.ViewPager2.mFakeDragger' on null object
We are seeing this crash on Firebase for few of our users during layout inflation:
Fatal Exception: java.lang.RuntimeException: Unable to resume activity {com.abc.xyz/com.abc.xyz.onboarding.activity....
-1
votes
1
answer
15
views
Scroll two dirreferent viewpagers same time in android
i need scroll my view pagers same time when scroll one view pager. also those viewpagers has different item width. bottom view pager is full width content and top view pager smaller than bottom view ...
1
vote
0
answers
43
views
The first fragment added to the adapter is not displayed. The second one is displayed perfectly. Databinding works, tried without ViewPager
When adding fragments to the adapter, the first TariffUserAndQuestFragment is not displayed, everything is fine with the second TariffOurServicesFragment. I tried swapping them anyway ...
0
votes
1
answer
56
views
ViewPager2, FragmentStateAdapter, and conflict between pager's currentItem and adapter's createFragment's position parameter [duplicate]
When implementing ViewPager2 and its associated FragmentStateAdapter for its contents in Kotlin, I ran into a weird issue: It has to do with the adapter's createFragment(position: Int) method and ...
0
votes
1
answer
108
views
MenuProviders are not switched automatically inside a ViewPager
I have a ViewPager with 2 Fragments. Each Fragment holds a MenuProvider which is added as follows:
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
...
0
votes
0
answers
23
views
Infinitely scrollable list
Please tell me if there are already existing good libraries of horizontally infinitely scrollable scrollers, preferably with an indicator display at the bottom. I have found several implementations, ...
0
votes
0
answers
11
views
How can I set values of switcher in all fragments of a viewpager, by changes one switch in MainActivity
I am developing one android application and it has a tab layout with ViewPager setup. I have totally 8 fragments in the viewpager. Each Fragment holding an RecyclerView. The recyclerview row has one ...
0
votes
0
answers
36
views
Fragment Toolbar menu not visible onBackPressed
I have ViewPager with fragment MAIN and each fragment has it's own toolbar menu. When i click on option menu 1 which launch just simple fragment with no menu and when i press back button the fragment ...
0
votes
0
answers
22
views
Update all other tabs in ViewPager
I am building TODO list app using MVVM architecture.
I have view pager with 3 tabs: Daily, Weekly, and Monthly.
When I edit a task from daily tab and save it to the database,I can see the updated task ...
0
votes
0
answers
21
views
ViewPager: After activity recreated, one Fragments stays empty
I have a ViewPager with two Fragments in it. When both are loaded,
I change the language, or the Dark Mode of the app,
So the underlying Activity is recreated (I think this is what triggers the bug),
...
1
vote
1
answer
219
views
How to Implement Fade In / Fade Out Animation in Horizontal Pager Android Compose
Iam designing a Horizontal Pager in Android Jetpack Compose using googles accompanist Pager
(implementation "com.google.accompanist:accompanist-pager:0.24.2-alpha").
I Implement this ...
0
votes
0
answers
12
views
cannot scroll vertically in viewpager
In my app I use AppBarLayout inside coordinatorlayout. There should be two tabs hosting two fragments and the viewpager fill out the rest of the page. However, I cannot vertically scroll down the ...
0
votes
1
answer
39
views
implementation of viewPager2
I implemented viewPager and it was working fine but now I want to move to viewPager2 but I don't know what to write instead of addOnPageChangeListener because I have an error on it and there is no ...
0
votes
1
answer
25
views
How to correctly inflate menus for an action bar from viewpager fragments
I have my viewpager as follows:
val pagerAdapter = ViewPagerAdapter()
viewPager2.apply { offscreenPageLimit = 2; adapter = pagerAdapter }
override fun createFragment(position: Int): Fragment = list[...
0
votes
0
answers
10
views
Mentain VideoView state in ViewPager fragment in android
I have some problem with maintaining VideoView state in ViewPager fragment , when I scroll fragment A to fragment B than video will stop from fragment A, and when I back to fragment A than VideoView ...
0
votes
0
answers
29
views
ViewPager: addOnPageChangeListener randomly called after activity recreate
I have ViewPager initialized inside MainActivity. Its working fine, but as soon as I call recreate() on MainActivity and activity is "recreated", during initialization my ViewPager is bugged ...
0
votes
1
answer
80
views
ViewPager2 with Fragment data set change
I'm trying to create tab layout with viewpager2 inside it having fragment and recylerview to show data. While using with Dummy data it is working fine, but when I need to update data in recylerview ...
1
vote
0
answers
12
views
TabLayout + ViewPager - ViewPager is clipping TabLayout elevation
I have bottom TabLayout which is connected to ViewPager above. TabLayout has top elevation which should be visible in front of ViewPager (want to have cool elevation fade out effect at the bottom of ...
0
votes
0
answers
30
views
FragmentStateAdapter with ViewPager2 and TabLayout switches page the first time only on second click after manually selecting initial page
I have a problem with my FragmentStateAdapter. Basically everything is working just fine besides one thing.
I do save the last visited tab so when the user comes back the initial tab always is the ...
0
votes
0
answers
96
views
View Pager 2 swipe between tabs doesn't work
I'm facing some problem with my ViewPager2. I have used a standard viewpager but since the FragmentPagerAdapter is deprecated I decided to migrate to ViewPager2.
That's how it looks like now
class ...
0
votes
1
answer
46
views
TabLayout swiping does not change Tab focus
I have a tabLayout and a viewPager underneath it. When I click on the tab, it switches tabs perfectly fine. However, when I swipe, the viewPage swipes over, but the tab does not change focus. I have ...
0
votes
1
answer
75
views
IndexOutOfBoundsException while swiping ViewPager
My application crashed while I was scrolling between cards on the ViewPager and this was the error that I got:
java.lang.IndexOutOfBoundsException: index=5 count=4"
I have absolutely no clue ...
1
vote
1
answer
457
views
Swipe sensitivity for HorizontalPager in Compose
I implemented a simple HorizontalPager which works mostly as expected. The app I develop is for one specific device, a 8" Tablet in landscape mode. At the moment it is required to swipe more than ...
0
votes
0
answers
24
views
Why my Viewpager is not showing images in recyclerview?
Actually i am new to android development and working on an app and trying to implement viewpager to show the images like carousel in recyclerview but don't know how to set the viewpager in ...
0
votes
1
answer
37
views
how to add support RtL into viewPager Kotlin?
I want to add or apply :
viewPager?.rotationY = 180F
to my view pager just when app language is setted to fa or ps from en. or prevent applying that when language is en.
I used viewPager?.rotationY = ...
1
vote
0
answers
19
views
ViewPager and tablayout not showing anything
I am following a youtube tutorial on a login/signup screen using ViewPager and tablayout. Unfortunately, both aren't working. I would very much appreciate it if you could help me find the solution for ...
0
votes
0
answers
104
views
Nested Scrolling inside a Viewpager2 inside a BottomSheet
It's 2022, and I'm having the same issue with ViewPager2 that folks had with ViewPager (see NestedScrolling inside a Viewpager inside a BottomSheetDialog ) - 5 years ago.
Although I'm not using a ...
0
votes
0
answers
15
views
Android ViewPager and transitions
I'm using ViewPager in my App as base component for screen switching. What I dont like is animation of transition. That animation is used based on in what order I put screens inside ViewPagerAdapter. ...
2
votes
0
answers
100
views
How to get vertical ViewPager curl page animation in Android
I am implementing a ViewPager for vertical scrolling. I have used ViewPager.PageTransformer for animation.
Below is my code.
public class VerticalPageTransformer implements ViewPager.PageTransformer {
...
1
vote
1
answer
258
views
ViewPager2 reuse fragments when popbackstack is called
I have main fragment with ViewPager2 that contains other fragments.
Each child fragment can open another detail fragment (main fragment replaced with details fragment).
When I go back to from detail ...
0
votes
0
answers
58
views
Replaceable Fragment in ViewPager2
I have a Fragment (lets call it RootFragment) containing aViewPager2 that switches between two fragments on tab1 and tab2. Only considering the fragment on tab2, it starts as showing Fragment 1, which ...
1
vote
1
answer
255
views
Recyclerview Not Scrolling Inside ViewPager
I have ViewPager2 with 3 Fragments and all has recyclerview but in Middle fragment recyclerview not scrolling if i try to touch recyclerview Items but it scroll smoothly if i touch right or left side ...
0
votes
0
answers
35
views
Using ViewPager2 to step-by-step SignUp form with Fragments
I'm trying to implement a SignUp form with viewpager2 where the user is asked to input its name, password, phone number and photo in a 4-step sequential prompt. So I have an activity that contains a ...
2
votes
0
answers
377
views
Accompanist Nested HorizontalPager disable swipes in parent
I have a nested HorizontalPager like
HorizontalPager(
count = list.size
) {
HorizontalPager(
count = list2.size
) {
//items
}
}
is there any way to disable horizontal scrolling ...
1
vote
1
answer
1k
views
Jetpack compose Accompanist HorizontalPager doesn't detect swipes
I have a HorizontalPager() in my screen and it doesn't detect swipes.
Just for test i created default HorizontalPager() via docs
Just pasted in my screen
HorizontalPager(count = 10) { page ->
...
0
votes
0
answers
231
views
ViewPager2 swipe not working when inside Compose AndroidView
I have an XML file that I'm migrating to compose. I started by changing the ViewPager2 into ComposeView like below
<androidx.core.widget.NestedScrollView
-- rest of the elements --
<...
0
votes
1
answer
91
views
Android ViewPager2: Not being able to make ViewPager2 width adjust to its content
This is my main -non scrolling- content:
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
</data>
<RelativeLayout
...
1
vote
0
answers
291
views
OffscreenPageLimit behaviour for ViewPager from Accompanist
I am using HorizontalViewPager from Accompanist to show an image in each page of the viewpager. I am loading images with Coil. Here's the code:
val pagerState = rememberPagerState()
HorizontalPager(...
0
votes
0
answers
92
views
ViewPager2 + FragmentStateAdapter + offscreenPageLimit = 1 => onResume not called
I'm having an issue with my ViewPager, but I don't know why and how to fix it.
So I have a ViewPager2 on which I'm using a FragmentStateAdapter.
This pager contains approx 10 pages (not really ...
0
votes
1
answer
138
views
can't navigate by Navigation action from viewpager fragment
I have a fragment named ViewPagerFragment which comes to the display when I select a menu in bottomNavigationView. It becomes the currentDestination of navHostFragment.
In the viewPagerFragment there ...
0
votes
0
answers
42
views
ViewPager with Bottom Navigation Wont Call onViewCreated Method Until select a Bottom Tab
Sorry for the complicated question I don't know how to ask that
I have a Bottom Tabbar set to index 3 when the app first launch
and in index 2 of the BottomBar there is a Fragment and inside that ...
0
votes
0
answers
14
views
Fragment does not load inside ViewPagerAdapter android
I have a MainActivity with a NavHostFragment and a BottomNavigationView.
<fragment
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation....