布局
- 线性布局
- 相对布局
线性布局
- id
- Layout_width
- Layout_height
- background
- Layout_margin:外部边
- Layout_padding:内部边距
- Orientation:方向-横着还是数着
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<!--自动生成的是:androidx.constraintlayout.widget.ConstraintLayout约束性布局:不是很利于团队开发-->
<!--LinearLayout:线性布局 现在先用这个-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<!-- 里面有一个文本控件TextView-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--里面的内容是Hello World!-->
</LinearLayout>