需要水平滚动(Android)

Far*_*ari 1 android

我有一个在ScrollView中的TableLayout,所以我得到垂直滚动.但是当列超出屏幕时,我也想要水平滚动.

我怎样才能做到这一点?请帮忙.

谢谢,法哈

who*_*who 6

看看这个,它可能是你想要的.

    <ScrollView 
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <HorizontalScrollView
            android:layout_width="fill_parent"          
            android:layout_height="fill_parent" >

                <TableLayout
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent">

                    <TableRow 
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent">
                        <ImageView android:src="@drawable/icon"/>
                        <ImageView android:src="@drawable/tube"/>
                    </TableRow>

                    <TableRow ....
                    </TableRow>

                    <TableRow ....
                    </TableRow>

               </TableLayout>

       </HorizontalScrollView>

    </ScrollView>
Run Code Online (Sandbox Code Playgroud)