Thread
#android-architecture
    u

    ursus

    3 years ago
    can one instance be technically part of 2 viewgroups?
    e

    edwardwongtl

    3 years ago
    No, this is forbidden to add a view(which has a parent view) to another viewgroup.
    u

    ursus

    3 years ago
    yea, thought so, well then it needs to be viewgroup.removeView(toBeCachedView)
    okay this is going to be a mess 😞
    e

    edwardwongtl

    3 years ago
    So you still need to detach the emoji view from the flow layout when the message view is recycled
    u

    ursus

    3 years ago
    yes, hence modifing the original layout, thats going to be trouble
    e

    edwardwongtl

    3 years ago
    But the original layout is going to be recycled, why is it causing trouble?
    u

    ursus

    3 years ago
    not sure, never tried transfering view from one viewgroup to another
    how about recyclerview instead of flowlayout, but with flowlayout manager, and wrap_content height to make it unscrollable and share viewpool
    e

    edwardwongtl

    3 years ago
    The action of detaching emoji view should be perform at the time which the original layout is being scrolled off screen, so that onViewRecycled will be called on the parent view.
    Using a flowLayoutManager can be a way, but I think the effort required is similar to this approach
    u

    ursus

    3 years ago
    okay Ill try it, wonder if it will work
    Katya Yurukova

    Katya Yurukova

    3 years ago
    you can try FlexboxLayoutManager https://github.com/google/flexbox-layout