Android TableLayout inside ScrollView
android, scrollview, tablelayout
Solution
add this line in your scrollview xml -->
android:fillViewport="true"
This enables the child layout to to take full screen if it's layout_width & layout_height is match_parent/fill_parent. . In your case TableLayout will get the full size on using this line ..! enjoy...!
Problem
I want both the ScrollView TableLayout to have same height as the screen, but whyy table is taken only half of the screen, whereas ScrollView is taking full screen as intended. I tried changing height of table and rows as wrap_content, but showing same result. Also changing height of table as fixed height (e.g. 900dp) is not working as well. Even the last row height is not showing full rating bar. Seems like table is forced to have that specific width. If I delete ScrollView, it works just fine. Can anyone please help. ``` <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:background="@drawable/border" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".EditEntry" > <TableLayout android:id="@+id/tableLayout1" android:layout_width="match_parent" android:layout_height="match_parent" > <TableRow android:id="@+id/tr3a" android:padding="2.5dp" android:background="@color/col1" android:gravity="center_vertical" android:layout_width="wrap_content" android:layout_height="0dp" android:layout_weight="1" > <TextView android:id="@+id/lab_bookname" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/bookname" /> <EditText android:id="@+id/bookname" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="@string/definputtext2" /> </TableRow> <TableRow android:id="@+id/tr3" android:padding="2.5dp" android:background="@color/col2" android:gravity="center_vertical" android:layout_width="wrap_content" android:layout_height="0dp" android:layout_weight="1" > <TextView android:id="@+id/lab_printname" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/print_name" /> <EditText android:id="@+id/printname" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="@string/definputtext2" /> </TableRow> ...................... ...................... ...................... </TableLayout> </ScrollView> ```