recyclerview或viewpager上的setRotationY(180)在Android 9(API 28)中创建滚动问题 [英] setRotationY(180) on recyclerview or viewpager creating scroll issue in Android 9(API 28)

查看:151
本文介绍了recyclerview或viewpager上的setRotationY(180)在Android 9(API 28)中创建滚动问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过为recyclerview和viewpagers实现setRotationY来管理RTL内容,但是似乎仅在具有API 28的设备中会产生滚动/滑动问题,否则它工作得很好.如果我删除setRotationY,它的工作就很好.有人遇到过这个问题吗?如果可以,该如何解决?

I am managing RTL contents by implementing setRotationY for recyclerview and viewpagers but it seems that it is creating scroll/swipe issues in only devices with API 28 otherwise it is working perfectly fine. It is working perfectly fine if I remove setRotationY. Has anyone faced this issue? If so, how to solve it?

P.S. :旋转360f不会影响滚动,但是旋转180f会影响滚动.

P.S. : Rotating 360f is not affecting the scroll but rotation 180f does.

推荐答案

由于ViewPager.setRotatingY(180),我在API 28上使用ViewPager遇到了这个问题,因此我可以支持RTL,我尝试用layoutDirection =替换旋转语言环境",但没有用.我找到了一个支持RTL ViewPager的库,这里有一个链接 https://github.com/duolingo/rtl-viewpager .

I had this issue with ViewPager on API 28 because of ViewPager.setRotatingY(180) so that i can support RTL, I've tried replacing rotation with layoutDirection="locale", but it didn't work. I found a library for supporting RTL ViewPager here's a link https://github.com/duolingo/rtl-viewpager.

将其添加到依赖项中,只需确保将layoutDirection ="locale"添加到RtlViewPager

Add it to dependencies and just make sure you add layoutDirection="locale" to the RtlViewPager

<com.duolingo.open.rtlviewpager.RtlViewPager
        android:layoutDirection="locale"
        android:keepScreenOn="true"
        android:id="@+id/quranViewpager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:animateLayoutChanges="true"
     />

更新

ViewPager2支持区域设置,因此它会根据当前设备的区域设置自动更改滑动方向.

ViewPager2 is locale friendly so it's automatically will change swipe direction according to the current device locale.

关于ViewPager2实施的一些有用链接:

Some helpful links on the implementation of ViewPager2:

Android文档

示例

这篇关于recyclerview或viewpager上的setRotationY(180)在Android 9(API 28)中创建滚动问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆