Search code examples
androidandroid-recyclerviewlinearlayoutmanager

How to custom LinearLayoutManager?


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.

enter image description here


Solution

  • 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.