(1)Android UI元素

  1. 视图(View)

    https://s3-us-west-2.amazonaws.com/secure.notion-static.com/122c697c-f5e4-4313-b80c-b32a0523fed0/Untitled.png

    🌟🌟🌟常见的子类及功能:

    TextView 文本视图

    EditText 编辑文本框

    Button 按钮

    Checkbox 复选框

    RadioGroup 单选按钮组

    别的用到的先查就行!

  2. 视图容器(View Group)

    https://s3-us-west-2.amazonaws.com/secure.notion-static.com/34bfc9e4-5d17-43ad-9e9a-efeb8ff740e2/Untitled.png

    https://s3-us-west-2.amazonaws.com/secure.notion-static.com/28a82f47-634c-4f31-8110-edc72fbe3f62/Untitled.png

  3. 布局管理(Layout)

    ViewGroup的子类,所有的布局都可以作为容器。

    LinearLayout(线性布局)、RelativeLayout(相对布局)、TableLayout(表格布局)、AbsoluteLayout(绝对布局)、ConstrainLayout(约束布局)

  4. Activity

  5. Fragment

    https://s3-us-west-2.amazonaws.com/secure.notion-static.com/bfa4bf29-3782-4afe-b107-a03211ec81dd/Untitled.png

(2)界面布局

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/90117a71-ee09-49ce-bf43-78805b3a7188/Untitled.png

(1)LinearLayout(线性布局):垂直或者水平方向排列

设定方法:android:orientation="vertical"
对齐方式:布局的对齐方式  android:gravity
          元素的对齐方式  android:layout_gravity

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/0d60e9db-06c3-467d-af11-800ee9732b13/Untitled.png

(2)TableLayout(表格布局):以行列的方式布局子组件

  行数的指定 是由<TableRow> </TableRow>标签来指定,
  列数的指定 是由<TableRow> </TableRow>中元素的个数来指定
  特殊属性: stretchColumns :当内容少的时候,指定哪一列伸展占满屏幕。序号从0开始
             shrinkColumns:当内容都的时候,指定那一列可以换行显示
             collapseColumns:隐藏指定列 序号从0开始

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/924a5c09-345c-42f1-848f-48280c07b1b3/Untitled.png

(3)RelativeLayout(相对布局):子组件的位置总是相对于兄弟组件或父容器

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/a8c460f0-f7a8-4838-a42a-96f2152dabef/Untitled.png

【上下左右中】布局 的实现步骤
   1. 确定基准点【中】的位置 : 【中】位于容器的中间,android:layout_centerInParent="true"
   2. 给基准点元素设定Id,让别人能找到它: android:id="@+id/mid"
   3. 添加【上】,位置是在【中】的上边。与【中】左对齐:android:layout_alignLeft="@id/mid"         android:layout_above="@id/mid"
   4.添加【下】,位置是在【中】的下边。与【中】左对齐:android:layout_alignLeft="@id/mid"         android:layout_bellow="@id/mid"
   5. 添加【左】,位置在【中】的左边,与【中】上对齐 android:layout_toLeftOf="@id/mid"        android:layout_alignTop="@id/mid"
   6. 添加【右】,位置在【中】的右边,与【中】上对齐android:layout_toRightOf="@id/mid"        android:layout_alignTop="@id/mid"

(4)AbsoluteLayout(绝对布局):

绝对布局:指定元素的绝对位置 ->不足:不能自适应不同分辨率的屏幕
          指定XY坐标点的位置: android:layout_y   android:layout_x

(5)ConstrainLayout(约束布局):指定四个边界在指定组件的哪个边界上