这个程序很简单,只是在xml中布局并显示一个TextView
<TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text"
android:layout_width="match_parent" android:layout_height="match_parent"
android:gravity="center_vertical|center_horizontal"
android:text="@string/hello_world"/>
android:layout_width="match_parent"
控件宽度: 原来的属性叫fill_parent,后来SDK修改了名字,但是作用不变
android:gravity="center_vertical|center_horizontal"
对齐方式: 垂直,水平居中对齐。
可以使用 | 符号来设置多个属性
效果如下