Fixed
Status Update
Comments
jb...@google.com <jb...@google.com> #2
Nested scrolling works partially (as per http://b/122818889 ). Let's discuss if we need full support and if so make sure it works.
kr...@gmail.com <kr...@gmail.com> #3
Hi!
What is 'partially' exactly?
How do I see it?
Thanks!
What is 'partially' exactly?
How do I see it?
Thanks!
kr...@gmail.com <kr...@gmail.com> #4
As of now:
- Nesting scroll views with a scroll direction perpendicular to the ViewPager2's orientation inside ViewPager2 works
- Nesting scroll views with a scroll direction parallel to the ViewPager2's orientation inside ViewPager2 does not work
- Nesting scroll views with a scroll direction perpendicular to the ViewPager2's orientation inside ViewPager2 works
- Nesting scroll views with a scroll direction parallel to the ViewPager2's orientation inside ViewPager2 does not work
kr...@gmail.com <kr...@gmail.com> #5
Horizontal ViewPager2 not correctly working into a vertical RecyclerView
Set a setNestedScrollingEnabled to the RecyclerView into the ViewPager2 (across reflection) resolves the problem
Set a setNestedScrollingEnabled to the RecyclerView into the ViewPager2 (across reflection) resolves the problem
kr...@gmail.com <kr...@gmail.com> #6
ageevvalentin@gmail.com, could you provide a sample app? I'd like to learn more about the circumstances that cause the problem; putting a clean ViewPager2 inside a clean RecyclerView seems to work fine, so there must be other factors involved.
jb...@google.com <jb...@google.com> #7
Added a patch for androidx-master-dev that demos a horizontal ViewPager2 inside a vertical RecyclerView.
Verified that it works correctly on a:
- Nexus 4 emulator with API 17
- Nexus 5X emulator with API 28
- Pixel 2 device with API 29
To reproduce:
- Check out the Android Jetpack source (at commit 256899f482ff85cddfb050f37550be7b5ec927ef) (see steps in [1])
- Apply the patch (`git apply 0001-Add-sample-where-a-horizontal-ViewPager2-is-nested-i.patch`)
- Build and install viewpager2's integration-tests app: `./gradlew viewpager2:integration-tests:testapp:installDebug`
- Run it
Closing the issue for now, but please reopen if you have a minimal reproduction app
[1]https://android.googlesource.com/platform/frameworks/support/+/256899f482ff85cddfb050f37550be7b5ec927ef
Verified that it works correctly on a:
- Nexus 4 emulator with API 17
- Nexus 5X emulator with API 28
- Pixel 2 device with API 29
To reproduce:
- Check out the Android Jetpack source (at commit 256899f482ff85cddfb050f37550be7b5ec927ef) (see steps in [1])
- Apply the patch (`git apply 0001-Add-sample-where-a-horizontal-ViewPager2-is-nested-i.patch`)
- Build and install viewpager2's integration-tests app: `./gradlew viewpager2:integration-tests:testapp:installDebug`
- Run it
Closing the issue for now, but please reopen if you have a minimal reproduction app
[1]
kr...@gmail.com <kr...@gmail.com> #8
Re-opening as requested by a few users. Narrowed down the focus to nested scrolling elements with the same scroll direction.
jb...@google.com <jb...@google.com>
ap...@google.com <ap...@google.com> #9
Any progress on this? (only talking about the "same scroll direction" issue)
I searched a lot for workarounds on Google and SO, but it seems no one really found a suitable solution yet.
The thing is that all other VerticalViewPagers out there have other problems that are similarly annoying. Most of them revolve around touch issues like "What's a click and what's a swipe" or "what's the fling threshold to snap to the next page".
So if someone knows of a working sample of VerticalViewPagers, I'd be happy to see a link :)
I searched a lot for workarounds on Google and SO, but it seems no one really found a suitable solution yet.
The thing is that all other VerticalViewPagers out there have other problems that are similarly annoying. Most of them revolve around touch issues like "What's a click and what's a swipe" or "what's the fling threshold to snap to the next page".
So if someone knows of a working sample of VerticalViewPagers, I'd be happy to see a link :)
jb...@google.com <jb...@google.com> #10
Hi, we're unlikely to address the "same scroll direction" issue before 1.0-Stable as it's likely going to require API changes (so v1.1+).
One possible option for VerticalViewPager with nested scrolling in the same scroll direction is using a RecyclerView implementing NestedScrollingParent + PagerSnapHelper to get snapping.
You'd then have to implement the NestedScrollingParent/Child contract between parent/child RecyclerView instances.
One possible option for VerticalViewPager with nested scrolling in the same scroll direction is using a RecyclerView implementing NestedScrollingParent + PagerSnapHelper to get snapping.
You'd then have to implement the NestedScrollingParent/Child contract between parent/child RecyclerView instances.
kr...@gmail.com <kr...@gmail.com> #11
Cool, thanks for this quick answer - Both pieces of information are highly appreciated (rough estimate of tackling this as well as giving hint on how to do it).
I will try implementing what you suggested and in case it is readable code, I will post it here as sample project or somthing similar.
I will try implementing what you suggested and in case it is readable code, I will post it here as sample project or somthing similar.
na...@google.com <na...@google.com> #12
That'd be great, much appreciated!
Description
Version used: every version since 2.4.0 (latest tested version is 2.5.1)
Latest version working correctly: 2.3.5
Devices/Android versions reproduced on: Emulator API 30, Oppo CPH2251 API 30, Samsung Galaxy S21 API 31
Repro steps:
1. Define the following 3 graphs (sample project is attached to this bug report):
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="
xmlns:app="
xmlns:tools="
android:id="@+id/level_0_graph"
app:startDestination="@id/level_0_fragment">
<fragment
android:id="@+id/level_0_fragment"
android:name="com.example.nestedpopupto.Level0Fragment"
tools:layout="@layout/fragment_level_0">
<action
android:id="@+id/to_level_1"
app:popUpTo="@id/level_0_graph"
app:destination="@id/level_1" />
</fragment>
<navigation
android:id="@+id/level_1"
app:startDestination="@id/level_1_graph">
<include app:graph="@navigation/level_1_graph" />
</navigation>
</navigation>
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="
xmlns:app="
xmlns:tools="
android:id="@+id/level_1_graph"
app:startDestination="@id/level_1_fragment">
<fragment
android:id="@+id/level_1_fragment"
android:name="com.example.nestedpopupto.Level1Fragment"
tools:layout="@layout/fragment_level_1">
<action
android:id="@+id/to_level_2"
app:popUpTo="@id/level_1_graph"
app:destination="@id/level_2" />
</fragment>
<navigation
android:id="@+id/level_2"
app:startDestination="@id/level_2_graph">
<include app:graph="@navigation/level_2_graph" />
</navigation>
</navigation>
<navigation xmlns:android="
xmlns:app="
xmlns:tools="
android:id="@+id/level_2_graph"
app:startDestination="@id/level_2_fragment">
<fragment
android:id="@+id/level_2_fragment"
android:name="com.example.nestedpopupto.Level2Fragment"
tools:layout="@layout/fragment_level_2">
</fragment>
</navigation>
2. Use "to_level_1" to navigate to nested graph.
3. Use "to_level_2" action.
Result:
The action "to_level_2" will fail with the following stacktrace:
java.lang.IllegalArgumentException: No destination with ID 2131230965 is on the NavController's back stack. The current destination is Destination(com.example.nestedpopupto:id/level_2_fragment) class=com.example.nestedpopupto.Level2Fragment
at androidx.navigation.NavController.getBackStackEntry(NavController.kt:2209)
at androidx.navigation.NavController.addEntryToBackStack(NavController.kt:1918)
at androidx.navigation.NavController.addEntryToBackStack$default(NavController.kt:1813)
at androidx.navigation.NavController$navigate$4.invoke(NavController.kt:1721)
at androidx.navigation.NavController$navigate$4.invoke(NavController.kt:1719)
at androidx.navigation.NavController$NavControllerNavigatorState.push(NavController.kt:287)
at androidx.navigation.fragment.FragmentNavigator.navigate(FragmentNavigator.kt:246)
at androidx.navigation.fragment.FragmentNavigator.navigate(FragmentNavigator.kt:162)
at androidx.navigation.NavGraphNavigator.navigate(NavGraphNavigator.kt:83)
at androidx.navigation.NavGraphNavigator.navigate(NavGraphNavigator.kt:49)
at androidx.navigation.NavGraphNavigator.navigate(NavGraphNavigator.kt:83)
at androidx.navigation.NavGraphNavigator.navigate(NavGraphNavigator.kt:49)
at androidx.navigation.NavController.navigateInternal(NavController.kt:260)
at androidx.navigation.NavController.navigate(NavController.kt:1719)
at androidx.navigation.NavController.navigate(NavController.kt:1545)
at androidx.navigation.NavController.navigate(NavController.kt:1472)
at androidx.navigation.NavController.navigate(NavController.kt:1930)
at com.example.nestedpopupto.Level1Fragment.onViewCreated$lambda-0(Level1Fragment.kt:13)
The crash will NOT occur if any of the following is applied:
- the "to_level_2" action does not use "popUpTo"
- the "level_2_graph" is not wrapped with the <navigation>.
As one can see the "to_level_1" action is identical to the "to_level_2" action and is defined in an identical graph and it works correctly. It seems that the bug occurs only when navigation is performed in the graph that is included in an other graph.
In the end I would like to remind that everything works correctly with version 2.3.5 of the androidx.navigation.