Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Why is android coordinatorlayout not working with viewpager?


Asked by Journey Bernard on Nov 29, 2021 Android



The idea is to let the viewpager have the layout_behavior attribute. This might be dumb, but it didn't worked due to the fact that the build tool was not updated in the build.gradle of the application version to 22, I was using 21 that is why it is not working as expected to be.
In addition,
Using CoordinatorLayout in Android apps. The CoordinatorLayout is a new layout, introduced with the Android Design Support Library. The CoordinatorLayout is a super-powered FrameLayout (according to the official documentation). If you have used a FrameLayout before, you should be very comfortable using CoordinatorLayout.
Likewise, ViewPagers are used to swipe through pages of data. It’s generally used in conjunction with fragments. Let’s modify our layout from the previous tutorial as below. Before we add up our ViewPager in the MainActivity, let’s set up it’s adapter.
Indeed,
It’s due to the ListView. The CoordinatorLayout doesn’t support the ListView (it’s not a part of Material Design) and it’s scrolling gestures. Hence it’s recommended to use RecyclerView instead.
Keeping this in consideration,
Support nested scrollable elements ViewPager2 does not natively support nested scroll views in cases where the scroll view has the same orientation as the ViewPager2 object that contains it. For example, scrolling would not work for a vertical scroll view inside a vertically-oriented ViewPager2 object.