【发布时间】:2019-08-28 20:38:37
【问题描述】:
在 Android 文档中,您需要编写 android.support.constraint.ConstraintLayout 来声明一个 ConstraintLayout。要声明一个 LinearLayout,您只需要LinearLayout。为什么不一致?
例如:(直接取自 Android 文档)
约束布局
<android.support.constraint.ConstraintLayout ...>
<Button android:id="@+id/button" ...
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent/>
</>
线性布局
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:orientation="horizontal"
android:gravity="center">
<!-- Include other widget or layout tags here. These are considered
"child views" or "children" of the linear layout -->
</LinearLayout>
你为什么不能只写<ConstraintLayout ... 而不是That's Just the Way it Is?
【问题讨论】:
标签: android android-linearlayout android-constraintlayout