Vertical and horizontal scrolling

Sometimes you need to show a lot of information in a small space,

for example in TableLayout, you can to make a vertical and horizontal scrolling.

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

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

         <TableLayout
                  android:id="@+id/amortization"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content">

              <TableRow
                  android:background="#3366FF">
                  <TextView
                       android:text="@string/tableRow_1"
                       android:background="#FFFFFF"
                       android:padding="3dip"/>
                  <TextView
                       android:text="@string/hello_world_1"
                       android:padding="3dip"/>
                  <TextView
                       android:text="@string/hello_world_2"
                       android:padding="3dip"/>
                  <TextView
                       android:text="@string/hello_world_3"
                       android:padding="3dip"/>
                  <TextView
                       android:text="@string/hello_world_4"
                       android:padding="3dip"/>
                  <TextView
                       android:text="@string/hello_world_5"
                       android:padding="3dip"/>
                  <TextView
                       android:text="@string/hello_world_6"
                       android:padding="3dip"/>
                  <TextView
                       android:text="@string/hello_world_7"
                       android:padding="3dip"/>
                  <TextView
                       android:text="@string/hello_world_8"
                       android:padding="3dip"/>
                  <TextView
                       android:text="@string/hello_world_9"
                       android:padding="3dip"/>
              </TableRow>
         </TableLayout>
    </HorizontalScrollView>
</ScrollView>

you can download this code: download code

Leave a Reply

Your email address will not be published. Required fields are marked *