Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TableLayout within HorizontalScrollView

I am using following code to create a TableLayout which is scrollable horizontally:

      <?xml version="1.0" encoding="utf-8"?>
      <HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
           android:layout_width="fill_parent"
           android:layout_height="fill_parent"
           android:minWidth="200dp"
           android:scrollbars="none">

       <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"            android:id="@+id/maintable2"
                android:layout_width="fill_parent"                  
                android:layout_height="fill_parent"                     
                android:stretchColumns="*"                      
                android:background ="#dddddd"           
                android:scrollbars="none"   >       
       </TableLayout>               
   </HorizontalScrollView>

I need the columns in the TableLayout to at least fill the screen (i.e. if there is only one column, the borders of that columns should stretch over the whole screen, if there are two columns, the borders of both columns should fill the screen etc.).

How can I do that?

like image 855
deimos1988 Avatar asked Dec 21 '22 13:12

deimos1988


1 Answers

I had the same problem. I solved it by adding android:fillViewport="true" to the HorizontalScrollView.

like image 158
guspodes Avatar answered Dec 28 '22 05:12

guspodes