HorizontalPicker icon indicating copy to clipboard operation
HorizontalPicker copied to clipboard

scaledownby, scaledowndistance not work at the start app.

Open ehog0613 opened this issue 8 years ago • 3 comments

Item is imageview. I make drawable xml file like round shape, and setImageresource xml file. When i was start app, No scaleDown, No scaleDownDistance, looks like 0dp margin. I touch recyclerview, suddenly work scaleDown, scaleDownDistance. Why does this happen?

ehog0613 avatar Jul 05 '17 02:07 ehog0613

Hey thanks for pointing that out

Actually, I have overridden scrollHorizontallyBy(int dx, RecyclerView.Recycler recycler, RecyclerView.State state) method of LinearLayoutManger So till the moment, this method is called nothing is scaling down. Easy but hacky fix will be call recyclerView.scrollBy(10, 0);

Will try to fix it.

adityagohad avatar Jul 06 '17 09:07 adityagohad

Thanks for your advice. I tried it but didn't work. Sorry.

Here is my code.

PickerLayoutManager pickerLayoutManager = new PickerLayoutManager(getContext(), PickerLayoutManager.HORIZONTAL, false);
pickerLayoutManager.setChangeAlpha(true);
pickerLayoutManager.setScaleDownBy(0.4f);
pickerLayoutManager.setScaleDownDistance(0.3f);

SnapHelper snapHelper = new LinearSnapHelper();
snapHelper.attachToRecyclerView(recyclerview);

recyclerview.setLayoutManager(pickerLayoutManager);

Adapter adapter = new Adapter();
recyclerview.setAdapter(adapter);
recyclerview.scrollBy(10, 0);

I want show like this. O O O O O

O is round item.

but it show like this. no margin between items. OOOOO

Thanks again. Have a good day.

ehog0613 avatar Jul 11 '17 02:07 ehog0613

Hi I solve this problem.

I try recyclerview.scrollBy method but it doesn't work. but recyclerview.smoothScrollBy method is work!

Thanks for your ideas. Today is Happy day! :-) 👍👍

ehog0613 avatar Jul 11 '17 02:07 ehog0613