-
Notifications
You must be signed in to change notification settings - Fork 156
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
Items that are not ImageViews cause disorted photos #10
Comments
Never mind, got that working. |
@eshkoliGilad I have the same issue, when my ImageView is wrapped with another layout it is disorted. How did you fix that please ? |
I've just made sizeForChildAtPosition() method of GreedoLayoutManager static and I call it in OnBind in the adapter:
|
@eshkoliGilad Ok so you had to update the library code. In that case your issue is still valid. I opened a similar one here #16 |
@eshkoliGilad It will helpful if you share GreedoLayoutManager class, I'm also struggling to over come this issue. |
The only thing I did was setting sizeForChildAtPosition() static and then in you onBind() function just calling: holder.mImageView.getLayoutParams().width = GreedoLayoutManager.sizeForChildAtPosition(position).getWidth(); You may consider using this on your main container also if this doesn't help you. I know it is not the perfect solution, but it was the quickest one. |
@eshkoliGilad can you share your GreedoLayoutManager class, if you don't mind? |
@eshkoliGilad hey, it will really helpful to me if you share your GreedoLayoutManager class, I'm stuck with this issue for a week. thanks |
Just change the method to public & static. It works. |
Just changing the method to static will not work, as it accesses instance variables which of course aren't valid in a static context. What I did instead was to give the GreedoLayoutSizeCalculator (which can be retrieved by GreedoLayoutManager#getSizeCalculator()) to my adapter. I just added a member variable and a setter. After that you can just do the following within your onBindViewHolder(...) method:
I still don't really like this because I feel like it doesn't really match the concept of adapters and layout managers, but if I remember correctly I didn't have to change any library code. |
When I'm trying to wrap ImageView with, say, RelativeLayout, the items becomes disorted.
Why is that ? I want to add views on top of imageView so I need a container but that makes thing look very bad.
Any idea why ?
The text was updated successfully, but these errors were encountered: