接下來會開始介紹android studio一些基本的元件,這些元件雖然看似簡單不過也有不少屬性可以設定,這些元件也將在未來不管大大小小的專案中不斷出現,所以盡可能練習用到得心應手,對未來寫程式也會順利不少。
首先介紹幾個基本的屬性設定:
<resources>
    <color name="purple_200">#FFBB86FC</color>
    <color name="purple_500">#FF6200EE</color>
    <color name="purple_700">#FF3700B3</color>
    <color name="teal_200">#FF03DAC5</color>
    <color name="teal_700">#FF018786</color>
    <color name="black">#FF000000</color>
    <color name="white">#FFFFFFFF</color>
    <color name="red">#FF0000</color>
    <color name="green">#00FF00</color>
    <color name="yellow">#FFFF00</color>
</resources>
以下為簡單的例子
<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
        android:id="@+id/tx1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="大小20sp"
        android:textStyle="italic"
        android:textColor="#009688"
        android:textSize="20sp"/>
    <TextView
        android:id="@+id/tx2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="大小40sp"
        android:textStyle="bold"
        android:textColor="@color/green"
        android:textSize="40sp"/>
    <TextView
        android:id="@+id/tx3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="背景黑色"
        android:background="@color/black"
        android:textColor="@color/yellow"
        android:textSize="30sp"/>
</LinearLayout>

TextView就簡單介紹到這裡,謝謝大家![]()