I need create something like this in xml, but it is not possible to center inner object in scrollView with child horizontalScrollView.
here is code example:
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="5"
android:fillViewport="true" >
<HorizontalScrollView
android:id="@+id/horizontalScrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableLayout
android:id="@+id/matrix_table"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" >
<!-- auto generated rows -->
</TableLayout>
</RelativeLayout>
</HorizontalScrollView>
</ScrollView>
and here is unexpected result
Thanks!
Setting a child view to
fill_parentdoesn’t work very well in ScrollViews. Instead, you should set the child view dimensions towrap_contentand uselayout_gravity: