Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scaledownby, scaledowndistance not work at the start app. #3

Open
ehog0613 opened this issue Jul 5, 2017 · 3 comments
Open

scaledownby, scaledowndistance not work at the start app. #3

ehog0613 opened this issue Jul 5, 2017 · 3 comments

Comments

@ehog0613
Copy link

ehog0613 commented Jul 5, 2017

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?

@adityagohad
Copy link
Owner

adityagohad commented Jul 6, 2017

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.

@ehog0613
Copy link
Author

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
Copy link
Author

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!
:-) 👍👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants