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

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章