ViewStub与View.GONE [英] ViewStub vs. View.GONE

查看:197
本文介绍了ViewStub与View.GONE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我已了解,既不是 ViewStub ,也没有一种观点认为是 GONE 参加措施和布局传递(或渲染反正)。

As far as I undestand, neither a ViewStub nor a View that's GONE participate in the measure and layout passes (or rendering anyway).

有没有渲染性能有区别吗?什么是什么时候使用的最佳做法有哪些?

Is there a difference in rendering performance? What's the best practice about when to use which?

推荐答案

渲染性能进入画面,当你膨胀的意见。

The rendering performance comes into picture when you are inflating the views.

我的猜测是,它的便宜得多,一膨胀比ViewStub膨胀视图,无论是从XML或改变的知名度。当您需要添加/删除(不确定)的意见(如电话号码添加到给定的联系人)ViewStub特别适用。希望这是你所期待的。

My guess is that its much cheaper to inflate a ViewStub than to inflate a View, either from XML or by changing visibility. ViewStub is especially used when you need to add/remove (indefinite) views (eg. add phone numbers to a given contact). Hope this is what you were looking for.

这篇关于ViewStub与View.GONE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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