问题描述
我里面有很多在里面的表格布局相对布局,因为其中我有警告:
I have a Relative layout which has a lot of Table layouts in it, because of which I am having the warning:
Layout has more than 80 views, bad for performance
在所有这些我的表布局,只有一个是可见的时间,基于来自微调的选择,我的问题是将它也伤害了性能还是其良好的去用这种方法?
Out of all my those table layouts, only one will be visible at a time, based on selection from spinner, my question is will it also hurt performance or its good to go with this approach?
而不是把它们放在单独的布局文件,我把它们放在单独的文件,因为在这种情况下,我将结束与一个地狱很多XML文件。
Instead of putting them in separate layout files, I put them in single file because in that case I will end up with a hell lot of xml files.
在XML文件中,只有第一个表的布局是可见的,其他所有的:
In the xml file, only first table layout is visible, all others have:
android:visibility="gone"
请指教...
推荐答案
是,隐藏的布局做影响性能的原因,即使他们不显示,他们仍然认为层次结构的一部分。尝试寻找到 ViewStub
来看看它是否适合您需求的有效替代:的
Yes, hidden layouts do impact performance cause even though they are not displayed, they are still part of the view hierarchy. Try looking into ViewStub
to see if it's a valid replacement for your needs: See Documentation
这篇关于不要隐藏布局影响性能或不?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!