w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
ScrollView inside TableLayout in android

Try some thing like this,

<TableLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:shrinkColumns="*"  android:stretchColumns="*"
android:background="#ffffff"> 


    <TableRow 
        android:layout_height="wrap_content" 
        android:layout_width="fill_parent" 
        android:gravity="center_horizontal">  
        <TextView 
            android:layout_width="match_parent"
android:layout_height="wrap_content"
            android:textSize="18sp" android:text="@string/com" 
android:layout_span="3"
            android:padding="18dip" android:gravity="center"
            android:textColor="#000"/>

    </TableRow>   



      <ScrollView
          android:id="@+id/scrollView1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" >

          <LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="vertical" >

              <TableRow
                  android:id="@+id/tableRow1"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:background="#b0b0b0"
                  android:gravity="center_horizontal" >

                  <TextView
                      android:id="@+id/textView2"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_marginTop="12dp"
                      android:gravity="center"
                      android:text="@string/c"
                     
android:textAppearance="?android:attr/textAppearanceMedium"
                      android:textSize="18sp" />
              </TableRow>

              <TableRow
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:gravity="center_horizontal" >

                  <TextView
                      android:id="@+id/TextView3"
                      android:layout_weight="1"
                      android:gravity="center"
                      android:text="@string/c1" />

                  <TextView
                      android:id="@+id/TextView4"
                      android:layout_weight="1"
                      android:gravity="center"
                      android:text="@string/c2" />
              </TableRow>

              <TableRow
                  android:id="@+id/tableRow2"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:background="#b0b0b0"
                  android:gravity="center_horizontal" >

                  <TextView
                      android:id="@+id/textView5"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_marginTop="12dp"
                      android:gravity="center"
                      android:text="@string/d"
                     
android:textAppearance="?android:attr/textAppearanceMedium"
                      android:textSize="18sp" />
              </TableRow>

              <TableRow
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:gravity="center_horizontal" >

                  <TextView
                      android:id="@+id/TextView6"
                      android:layout_weight="1"
                      android:gravity="center"
                      android:text="@string/d1" />

                  <TextView
                      android:id="@+id/TextView7"
                      android:layout_weight="1"
                      android:gravity="center"
                      android:text="@string/d2" />
              </TableRow>

              <TableRow
                  android:id="@+id/tableRow2"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:background="#b0b0b0"
                  android:gravity="center_horizontal" >

                  <TextView
                      android:id="@+id/textView5"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_marginTop="12dp"
                      android:gravity="center"
                      android:text="@string/e"
                     
android:textAppearance="?android:attr/textAppearanceMedium"
                      android:textSize="18sp" />
              </TableRow>

              <TableRow
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:gravity="center_horizontal" >

                  <TextView
                      android:id="@+id/TextView6"
                      android:layout_weight="1"
                      android:gravity="center"
                      android:text="@string/e1" />

                  <TextView
                      android:id="@+id/TextView7"
                      android:layout_weight="1"
                      android:gravity="center"
                      android:text="@string/e2" />
              </TableRow>

              <TableRow
                  android:id="@+id/tableRow2"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:background="#b0b0b0"
                  android:gravity="center_horizontal" >

                  <TextView
                      android:id="@+id/textView5"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_marginTop="12dp"
                      android:gravity="center"
                      android:text="@string/g"
                     
android:textAppearance="?android:attr/textAppearanceMedium"
                      android:textSize="18sp" />
              </TableRow>
          </LinearLayout>

      </ScrollView>

</TableLayout>




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.