3. Layout -- 1

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Your total is 0"
android:textColor="#005500"
android:background="#FF00FF"
android:textSize="45sp"
android:layout_gravity="center"    // Text水平居中显示
android:gravity="center"              //垂直居中显示
android:id="@+id/tvDiaplay"/>
<Button
android:layout_width="250dp"                         //Button控件的大小单位dp
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="22dp"
android:textSize="20sp"                                //字体用sp
android:text = "Add one"
android:id="@+id/add"/>
<Button
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="20sp"
android:shadowColor="#cccccc"
android:alpha="0.5"                                       //opciaty
android:textColor="#000000"
android:fitsSystemWindows="true"                 //fix screen, for example when action bar show up
android:id="@+id/second"
android:text = "Second"/>
</LinearLayout>

原文地址:https://www.cnblogs.com/Answer1215/p/3432626.html