I want to add custom grid divider to RecyclerView
, I have no idea please suggest some idea. For first row divider should start from beginning and for others it should be centered.
Asked
Active
Viewed 524 times
-1

Gowtham Subramaniam
- 3,358
- 2
- 19
- 31

Shanmugam
- 301
- 1
- 10
-
have you try any thing? – Tara Dec 07 '17 at 07:12
-
2this may be help you https://stackoverflow.com/a/47428318/8112541 – Goku Dec 07 '17 at 07:12
-
i can add single divider, but i have no idea to achieve above design. – Shanmugam Dec 07 '17 at 07:13
-
3Possible duplicate of [RecyclerView add divider lines only between some items](https://stackoverflow.com/questions/45612014/recyclerview-add-divider-lines-only-between-some-items) – Sree Dec 07 '17 at 07:13
-
Possible duplicate of [I want to make a layout like this.I applied stroke but i do not want it on corners, like in image](https://stackoverflow.com/questions/47428243/i-want-to-make-a-layout-like-this-i-applied-stroke-but-i-do-not-want-it-on-corne) – Tomin B Azhakathu Dec 07 '17 at 07:15
-
@Prem thanks , i will try... – Shanmugam Dec 07 '17 at 07:17
-
@Shanmugam welcome – Goku Dec 07 '17 at 07:19
-
@Prem how can i do for recycler view row item? – Shanmugam Dec 07 '17 at 07:20
-
@Shanmugam make that layout in your recyclerview item – Goku Dec 07 '17 at 07:24
-
@Prem i will check – Shanmugam Dec 07 '17 at 07:30
-
@Shanmugam did you solved it – Goku Dec 08 '17 at 07:57
1 Answers
0
For your solution we need to access middle column sequence 1,4,7,10...
to get that
if (i % 3 == 1) {
System.out.print(i);
}
from this you'll get position and by that change/ add padding to line

Hemanth S
- 669
- 6
- 16