可垂直或水平滚动的列表
ScrollView & HorizontalScrollView内部只能有一个直接的子元素,
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/button_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button1"/>
<Button
android:id="@+id/button_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TEST"
/>
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button1TESTTEST"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TESTTESTTEST"
/><Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ButTESTTESTTESTton1"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TETESTTESTTESTST"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button1TESTTEST"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TESTTESTTEST"
/><Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ButTESTTESTTESTton1"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TETESTTESTTESTST"
/>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
</ScrollView>