[Solved] What is the simplest way to create rows that scroll together and are composed of variable sized clickable Views with the same height on Android

[ad_1]

I was finally able to get it to work!!! with the following xml:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <com.example.hellooboe.FunctionView
        android:layout_width="500dp"
        android:layout_height="500dp">
    </com.example.hellooboe.FunctionView>

    <com.example.hellooboe.FunctionView
        android:layout_width="500dp"
        android:layout_height="500dp">
    </com.example.hellooboe.FunctionView>

    <com.example.hellooboe.FunctionView
        android:layout_width="500dp"
        android:layout_height="500dp">
    </com.example.hellooboe.FunctionView>

</LinearLayout>

FunctionView is my custom View, but you can add any View. This xml holds the horizontal rows.

I included the above layout (function_holder) in this xml:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <HorizontalScrollView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

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

        <include
            android:id="@+id/layout1"
            layout="@layout/function_holder">
        </include>

        <include
            android:id="@+id/layout2"
            layout="@layout/function_holder">
        </include>

        <include
            android:id="@+id/layout3"
            layout="@layout/function_holder">
        </include>
    </LinearLayout>
    </HorizontalScrollView>
</ScrollView>

It doesn’t scroll diagonally, but it is workable.

[ad_2]

solved What is the simplest way to create rows that scroll together and are composed of variable sized clickable Views with the same height on Android