【Android 入門指南】系列文章目錄:https://bit.ly/3TFgCzu
Android 線上課程教學影片:https://bit.ly/433Offj
本課程學習如何使用 LinearLayout 線性佈局中的orientation 排列方向屬性。
範例名稱:LinearLayout 線性佈局 orientation 垂直方向排列
作者:HKT (侯光燦)
授權範圍:使用時必須註明出處且不得為商業目的之使用
範例下載點:點我下載
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e6e6e6"
android:gravity="center"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="元件一" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="元件二" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="元件三" />
</LinearLayout>
範例名稱:LinearLayout 線性佈局 orientation 水平方向排列
作者:HKT (侯光燦)
授權範圍:使用時必須註明出處且不得為商業目的之使用
範例下載點:點我下載
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e6e6e6"
android:gravity="center"
android:orientation="horizontal">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="元件一" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="元件二" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="元件三" />
</LinearLayout>