can one instance be technically part of 2 viewgrou...
# android-architecture
u
can one instance be technically part of 2 viewgroups?
e
No, this is forbidden to add a view(which has a parent view) to another viewgroup.
u
yea, thought so, well then it needs to be viewgroup.removeView(toBeCachedView)
okay this is going to be a mess 😞
e
So you still need to detach the emoji view from the flow layout when the message view is recycled
u
yes, hence modifing the original layout, thats going to be trouble
e
But the original layout is going to be recycled, why is it causing trouble?
u
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
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
okay Ill try it, wonder if it will work
k
you can try FlexboxLayoutManager https://github.com/google/flexbox-layout