何时使用约束布局和如何有效地使用它?

编程入门 行业动态 更新时间:2024-10-28 17:27:55
本文介绍了何时使用约束布局和如何有效地使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

更多推荐

何时使用约束布局和如何有效地使用它?

本文发布于:2023-10-27 22:27:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1534731.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有效地   布局   使用它

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!