Like this effect (show half of the item) how to achieve it,I try to use custom LinearLayoutManager
, but failed because I cannot understand onMeasure
method.
Asked
Active
Viewed 1,005 times
-3
1 Answers
0
I am not sure if I understood your question, but you can try LinearLayout with weightSum
and assign the layout_weight
to child items. If you have exactly 2 child items you can provide weightSum
as 2 and layout_weight
as 1 in respective child item. Also make sure you make layout_width
as 0dp for child items.

Phantômaxx
- 37,901
- 21
- 84
- 115

am110787
- 316
- 1
- 2
- 9
-
`weightSum` is perfectly **optional**. – Phantômaxx Apr 27 '16 at 06:54
-
Maybe you're wrong ? This is a RecyclerView , LinearLayout is not LinearLayoutManager ,or I can't understand? – AliveDev Apr 27 '16 at 07:22
-
Misunderstood the question completely. Well if you want to have the effect like you shown in image, I would suggest to use ViewPager instead of Recycler View and you can specify the page width to achieve the desired result. You can refer this link https://commonsware.com/blog/2012/08/20/multiple-view-viewpager-options.html – am110787 Apr 27 '16 at 07:26
-
Thank you for your suggestion, if it is single, then it will be solved, However.It is multi row (not fixed) , so i want to use recyclerview to achieve it – AliveDev Apr 27 '16 at 09:08
-
Use RecyclerView for Vertical scrolling. But use viewPager for horizontal scrolling item. The problem with RecyclerView set as horizontal is that scrolling will not scroll single item. You will have to customise a lot to achieve single item scrolling like Google Play app. – am110787 Apr 27 '16 at 09:33