Skip to content

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

@dimsuz

Description

@dimsuz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions