android:orientation="vertical"表示该布局下的元素垂直排列;
在整体垂直排列的基础上想要实现内部水平排列,则在整体LinearLayout布局下再创建一个LinearLayout布局。
1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:orientation="vertical" 4 android:id="@+id/activity_main" 5 android:layout_width="match_parent" 6 android:layout_height="match_parent"> 7 8 9 <TextView 10 android:id="@+id/textView" 11 android:layout_width="match_parent" 12 android:layout_height="wrap_content" 13 android:text="合计" 14 android:textSize="20sp"