@@ -11,16 +11,15 @@ If you need snapping support to start, top, end or bottom, use GravitySnapHelper
11
11
Add this to your build.gradle:
12
12
13
13
``` groovy
14
- implementation 'com.github.rubensousa:gravitysnaphelper:1.5 '
14
+ implementation 'com.github.rubensousa:gravitysnaphelper:2.0 '
15
15
```
16
16
17
- Otherwise, center snapping is done with LinearSnapHelper (part of the recyclerview-v7 package) .
17
+ Otherwise, center snapping is done with LinearSnapHelper.
18
18
19
19
### Snapping center:
20
20
21
21
``` java
22
- SnapHelper snapHelper = new LinearSnapHelper ();
23
- snapHelper. attachToRecyclerView(recyclerView);
22
+ new LinearSnapHelper (). attachToRecyclerView(recyclerView);
24
23
```
25
24
26
25
### Snapping start with GravitySnapHelper:
@@ -29,23 +28,21 @@ snapHelper.attachToRecyclerView(recyclerView);
29
28
startRecyclerView. setLayoutManager(new LinearLayoutManager (this ,
30
29
LinearLayoutManager . HORIZONTAL , false ));
31
30
32
- SnapHelper snapHelperStart = new GravitySnapHelper (Gravity . START );
33
- snapHelperStart. attachToRecyclerView(startRecyclerView);
31
+ new GravitySnapHelper (Gravity . START ). attachToRecyclerView(startRecyclerView);
34
32
```
35
33
36
34
### Snapping top with GravitySnapHelper:
37
35
38
36
``` java
39
37
topRecyclerView. setLayoutManager(new LinearLayoutManager (this ));
40
38
41
- SnapHelper snapHelperTop = new GravitySnapHelper (Gravity . TOP );
42
- snapHelperTop. attachToRecyclerView(topRecyclerView);
39
+ new GravitySnapHelper (Gravity . TOP ). attachToRecyclerView(topRecyclerView);
43
40
```
44
41
45
42
## License
46
43
47
- Copyright 2016 The Android Open Source Project
48
- Copyright 2016 Rúben Sousa
44
+ Copyright 2018 The Android Open Source Project
45
+ Copyright 2018 Rúben Sousa
49
46
50
47
Licensed under the Apache License, Version 2.0 (the "License");
51
48
you may not use this file except in compliance with the License.
0 commit comments