zl程序教程

您现在的位置是:首页 >  移动开发

当前栏目

Android Studio学习笔记

2023-09-11 14:16:58 时间

布局

  1. 线性布局
  2. 相对布局

线性布局

  1. id
  2. Layout_width
  3. Layout_height
  4. background
  5. Layout_margin:外部边
  6. Layout_padding:内部边距
  7. 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>