Android移动开发之【通往安卓的神奇之旅】Android的五大布局和AndroidManifest

1 LinearLayout

在这里插入图片描述
光注点在orientation上和权重的设置

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#C0C0C0"
    android:orientation="vertical">

    <Button
        android:id="@+id/button"
        android:layout_weight="1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button2"
        android:layout_weight="4"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />
</LinearLayout>

2 FrameLayout

在这里插入图片描述

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#C0C0C0"
    android:orientation="vertical">

 <FrameLayout
     android:layout_width="wrap_content"
     android:layout_height="wrap_content">
     <TextView
         android:textSize="25dp"
         android:text="1111"
         android:layout_height="wrap_content"
         android:layout_width="wrap_content"
         />
    <TextView
        android:textSize="25dp"
        android:text="222"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        />
</FrameLayout>
</LinearLayout>

3 RelativeLayout

在这里插入图片描述
在这里插入图片描述
可以在属性中指定各个部件的距离和关系

4 绝对布局

不常用

5 TableLayout

在这里插入图片描述

6 AndroidManifest

在这里插入图片描述

发布了877 篇原创文章 · 获赞 237 · 访问量 9万+

猜你喜欢

转载自blog.csdn.net/weixin_43838785/article/details/104797246