简体   繁体   English

在Android Wear上具有RecyclerView的PagerSnapHelper

[英]PagerSnapHelper with RecyclerView on Android Wear

I want to implement vertical scroll pages. 我想实现垂直滚动页面。

In the documentation for the GridPagerAdapter it is mentioned that it is deprecated and as a replacement the developer should use RecyclerView with PagerSnapHelper. GridPagerAdapter的文档中,提到它已被弃用,并且作为替代,开发人员应将RecyclerView与PagerSnapHelper一起使用。

SnapHelper was introduced in version 24 of the RecyclerView library, and PagerSnapHelper in version 25. SnapHelper是在RecyclerView库的版本24中引入的,PagerSnapHelper是在版本25中引入的。

Unfortunately the com.google.android.support:wearable:2.0.0 dependency only includes recyclerview-v7:23.0.1 不幸的是com.google.android.support:wearable:2.0.0依赖项仅包括recyclerview-v7:23.0.1

Is there a way to fix this somehow? 有办法解决这个问题吗?

If this issue is still relevant, you can fix it, for example, in your build.gradle: 如果此问题仍然相关,则可以在例如build.gradle中修复它:

compile ('com.google.android.support:wearable:2.0.0') {
        exclude group: 'com.android.support', module: 'percent'
        exclude group: 'com.android.support', module: 'recyclerview-v7'
    }
compile 'com.android.support:recyclerview-v7:25.3.1'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM