Horizo​​ntalView和ScrollView可以保留片段吗? [英] Can HorizontalView And ScrollView Hold Fragments?

查看:221
本文介绍了Horizo​​ntalView和ScrollView可以保留片段吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想问一下这些布局是否可以容纳片段/多个片段.我基于Google Play商店.

I just would like to ask if these Layouts can hold fragment/multiple fragments. I base this on google play store.

对不起,逻辑不好.

推荐答案

,滚动视图可以容纳多个片段.

Yes, scroll views can hold multiple fragments.

但是,管理片段堆栈变得很棘手.

However, managing the fragment stack gets tricky.

因为如果我没有记错的话,fragmentManager/ChildFragmentManager只会维护一个容器的堆栈.

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.

即如果片段是在xml布局的滚动视图中描述的,并且您不执行片段事务,那么一切都很好.

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.

注意::我不认为Google Play在滚动视图"中使用片段.我所看到的是,如果您正在谈论的是在回收商视图中包含RecyclerViews

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

即垂直RecyclerView中有水平RecyclerView.

i.e. There are Horizontal RecyclerViews within Vertical RecyclerViews.

如果您不知道,RecyclerViews是listViews的新版本,它们功能更强大,并且执行方式也更好.

In case you are not aware, RecyclerViews are the new version of listViews, they are more powerful and perform way better.

我建议您不要使用listViews,而应使用RecyclerViews.

I suggest you don't use listViews, but use RecyclerViews instead.

这篇关于Horizo​​ntalView和ScrollView可以保留片段吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆