视图 views
such as:
文本视图 TextView
图像视图 ImageView //camel case 驼峰式
按键 Button
XML:
for TextView
dp: Density Independent Pixels 密度独立像素
按键的宽高至少48dp,48dp 大概等于 9mm
colors:
android:background="#90ee02"
android:textColor="#d602ee"
<TextView
android:text="Happy Birthday!"
android:background="@android:color/darker_gray"
android:layout_width="wrap_content"
android:layout_height="75dp"
android:textSize="75sp"
android:textAppearance="?android:textAppearanceLarge" />
for LinearLayout
children XML are the elements within the parent LinearLayout
each child XML has it's attributes like width, height, background
names are on the left, the values are on the right (has default values)
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:text="Happy Birthday"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:text="You're the best!"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
wrap_content : 适应文本大小
sp: Scale Independent Pixels 缩放无关像素 //用在字体大小设置
编写XML: