I'm having trouble getting the GridLayout to scroll horizontally.
I found a similar question Gridlayout + ScrollView . I tried this method, but it did not work.
It cuts out many tables (because it had to display all tables from 1 to 20).
Here is the xml file
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" > <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:padding="16dp" > <android.support.v7.widget.GridLayout android:id="@+id/table_mapGrid" android:layout_width="250dp" android:layout_height="wrap_content" /> </LinearLayout> </ScrollView> <include layout="@layout/cell_list_loading" /> <TextView android:id="@+id/table_errorView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginLeft="20dp" android:text="@string/message_error_connection" android:visibility="invisible" /> </FrameLayout>
I want dynamic content to display by changing the number of columns and rows, possibly with empty space between the tables. I did this, but the problem is that the width of the GridLayout is getting larger than its container, I wanted to solve using horizontal scrolling, but it does not seem to work ...
Any suggestion?
source share