问题
I just would like to ask if these Layouts can hold fragment/multiple fragments. I base this on google play store.
Sorry for bad logic.
回答1:
Yes, scroll views can hold multiple fragments.
However, managing the fragment stack gets tricky.
Because fragmentManager/ChildFragmentManager will only maintain stack for one container, if I am not wrong.
As long as you don't add them dynamically in run time,it is easy.
i.e. if the fragments are described in the scroll view from xml layout and you don't perform fragment transactions, you are all good.
I have dealt with the same issue, and cost me a lot of trouble but I did implement it. However, if you end up with such a requirement, you might be doing something wrong give other solutions a go and see if you can avoid this requirement.
NOTE : I don't think Google play uses fragments in Scroll Views. What I see them do is have RecyclerViews within recycler views, if this is what you are talking about
i.e. There are Horizontal RecyclerViews within Vertical RecyclerViews.
In case you are not aware, RecyclerViews are the new version of listViews, they are more powerful and perform way better.
I suggest you don't use listViews, but use RecyclerViews instead.
来源:https://stackoverflow.com/questions/37192331/can-horizontalview-and-scrollview-hold-fragments