初次開啟的預設配置
初次開啟一個Android Project時會自動生成下列檔案,可以觀察檔案
activity_main.xml
<RelativeLayout 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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.flowmahuang.test.MainActivity"
tools:showIn="@layout/activity_main">
</RelativeLayout>
xmlns:app
定義 app 前輟,讓標籤可以使用app:屬性名稱透過自行定義的屬性設定元件或框架。
xmlns:tools
定義 tools 前輟,讓標籤可以使用 tools:屬性名稱 來做額外設定。
xmlns:android
定義 android 前輟,讓標籤可以使用 android:屬性名稱 來設定元件或框架。
android:layout_width
寬度屬性,match_parent填滿整個視窗。
android:layout_height
長度屬性,match_parent填滿整個視窗。
android:paddingBottom
android:paddingTop
android:paddingLeft
android:paddingRight
設定 框架邊框和內容之間的內距。