何时使用约束布局和如何有效地使用它? [英] When to use Constraint Layout & How to use it efficiently?

查看:94
本文介绍了何时使用约束布局和如何有效地使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google最近提供了另一种布局,称为 ConstraintLayout 。但是,我有几个问题仍然很令人困惑。



我查看了相关的谈话并使用了Google IO'16的这一部分,并了解到,这对开发人员创建平坦的UI确实很有帮助,并且性能将比其他任何布局都要好。



问题:



1。。在这种情况下,我们应该使用约束布局吗?



2。。引入ContraintLayout是否意味着我们不再应该使用LinearLayout,RelativeLayout..etc?



3。什么是使用ContraintLayout的有效方法?

解决方案

您可能不应该这样



我建议您去观看名为 Android Layouts:一个新世界的会议



code>(当前不是在撰写本文时可用),其中详细介绍了 ConstraintLayout



ConstraintLayout似乎是一种更轻松的创建方法布局而不处理xml。 约束布局是基于RelativeLayout的,并不意味着要杀死其他布局,因为它们仍然非常有用。



这就是@ CommonsWare表示,这是非常新的内容,并且没有官方文档,因此很难真正得出结论。我想说的是,就像其他布局一样,使用情况将取决于您希望设计的外观


Google recently comes with another layout called ConstraintLayout However, I have few questions which is still very confusing.

I reviewed the talk related with this portion from google IO'16 and got an understanding that it would be really helpful as developer to create flat UI and performance would be better than any other layouts.

Questions:

1. In which case, We should use constraint layout?

2. Does introduction of ContraintLayout means that we should not use LinearLayout,RelativeLayout..etc anymore?

3. What is the efficient way to use ContraintLayout?

解决方案

You probably shouldn't have been so eager to jump on your question here since IO is still going on

I suggest you go watch the session called Android Layouts: a new world (currently not available at time of writing) where they go into detail about ConstraintLayout

ConstraintLayout appears to be an easier way to create layouts without dealing with xml. Constraints layout is based off of RelativeLayout and is not meant to kill off other layouts since they are still very useful.

This being said as @CommonsWare said this is very very new and has no official documentation so its very difficult to come to a real conclusion about it. I would say it is like other layouts where it is usage is going to be based on what you want your design to look like

这篇关于何时使用约束布局和如何有效地使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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