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
I am trying to create a GUI that looks kind of like this: _______________ _|___|___|_|_|_ _|___|___|_|_|_ Each rectangle is a unique clickable View. Need to scroll horizontally an
Solution 1:
I was finally able to get it to work!!! with the following xml:
<?xml version="1.0" encoding="utf-8"?><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:orientation="horizontal"xmlns:android="http://schemas.android.com/apk/res/android"><com.example.hellooboe.FunctionViewandroid:layout_width="500dp"android:layout_height="500dp"></com.example.hellooboe.FunctionView><com.example.hellooboe.FunctionViewandroid:layout_width="500dp"android:layout_height="500dp"></com.example.hellooboe.FunctionView><com.example.hellooboe.FunctionViewandroid: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"?><ScrollViewxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"><HorizontalScrollViewxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><includeandroid:id="@+id/layout1"layout="@layout/function_holder"></include><includeandroid:id="@+id/layout2"layout="@layout/function_holder"></include><includeandroid:id="@+id/layout3"layout="@layout/function_holder"></include></LinearLayout></HorizontalScrollView></ScrollView>
It doesn't scroll diagonally, but it is workable.
Post a Comment for "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"