如果内容横向和纵向太大,我怎样才能实现此表滚动?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/banner" />
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myTableLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow
android:background="@drawable/standard"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:text="@string/rankColumnHeader"
android:layout_margin="6sp"
android:textColor="@color/black"/>
<TextView android:text="@string/teamColumnHeader"
android:layout_margin="6sp"
android:textColor="@color/black"/>
<TextView android:text="@string/matchesColumnHeader"
android:layout_margin="6sp"
android:textColor="@color/black"/>
<TextView android:text="@string/winColumnHeader"
android:layout_margin="6sp"
android:textColor="@color/black"/>
<TextView android:text="@string/drawColumnHeader"
android:layout_margin="6sp"
android:textColor="@color/black"/>
<TextView android:text="@string/looseColumnHeader"
android:layout_margin="6sp"
android:textColor="@color/black"/>
<TextView android:text="@string/winPercentColumnHeader"
android:layout_margin="6sp"
android:textColor="@color/black"/>
<TextView android:text="@string/pointsColumnHeader"
android:layout_margin="6sp"
android:textColor="@color/black"/>
<TextView android:layout_margin="6sp"
android:textColor="@color/black"
android:id="@+id/demoTextView"/>
</TableRow>
</TableLayout>
</LinearLayout>
答案 0 :(得分:0)
我认为您应该能够将表放入ScrollView
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/banner" />
<ScrollView
android:layout_height="wrap_content"
android:id="@+id/scrollView1"
android:layout_width="fill_parent">
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myTableLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow
android:background="@drawable/standard"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:text="@string/rankColumnHeader"
android:layout_margin="6sp"
android:textColor="@color/black"/>
<TextView android:text="@string/teamColumnHeader"
android:layout_margin="6sp"
android:textColor="@color/black"/>
<TextView android:text="@string/matchesColumnHeader"
android:layout_margin="6sp"
android:textColor="@color/black"/>
<TextView android:text="@string/winColumnHeader"
android:layout_margin="6sp"
android:textColor="@color/black"/>
<TextView android:text="@string/drawColumnHeader"
android:layout_margin="6sp"
android:textColor="@color/black"/>
<TextView android:text="@string/looseColumnHeader"
android:layout_margin="6sp"
android:textColor="@color/black"/>
<TextView android:text="@string/winPercentColumnHeader"
android:layout_margin="6sp"
android:textColor="@color/black"/>
<TextView android:text="@string/pointsColumnHeader"
android:layout_margin="6sp"
android:textColor="@color/black"/>
<TextView android:layout_margin="6sp"
android:textColor="@color/black"
android:id="@+id/demoTextView"/>
</TableRow>
</TableLayout>
</ScrollView>
</LinearLayout>