我通过为 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?
附:: 旋转 360f 不影响滚动,但旋转 180f 会.
P.S. : Rotating 360f is not affecting the scroll but rotation 180f does.
我在 API 28 上遇到了 ViewPager 这个问题,因为 ViewPager.setRotatingY(180) 所以我可以支持 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)中创建滚动问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!