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

Add a default layout manager when using adopt()? #28

Open
dimsuz opened this issue May 2, 2020 · 2 comments
Open

Add a default layout manager when using adopt()? #28

dimsuz opened this issue May 2, 2020 · 2 comments

Comments

@dimsuz
Copy link

dimsuz commented May 2, 2020

When I started experimenting with this library I initially went with Recycler.create() which also created a layout manager for me. Then I decided that I don't want to manually call .addView() to put RV into my parent layout, so I placed RV in xml and called .adopt(findViewById()). Suddenly it crashed, because .adopt() doesn't create a layout manager, and RV throws an exception.

This feels a bit asymmetric and not intuitive. Would it be possible to add a layoutProvider argument to .adopt? I guess it could default to RV existing layoutManager...

My point is that it shouldn't matter if I created RV programmatically or inflated it from xml it should behave the same. Most other View work this way, e.g. FrameLayout doesn't apply some additional styling or whatever based on if I'm inflating or creating it from code.

@helios175
Copy link
Collaborator

Sorry about the "delay".
You're right. I will look into it soon. There might be some historic reasons for which the API is not symmetric but it doesn't need to be that way.

@helios175
Copy link
Collaborator

Addressed in #36 . I still have to publish a new version including that part.

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