Привет, ребята, как я могу получить представление, подобное этой ссылке, оно должно прокручиваться по вертикали и горизонтали, я начал делать это с помощью recyclerview, и он работает горизонтально, но как я могу заставить его работать вертикально.
Ссылка представления на выполнение https://i.stack.imgur.com/puxEi.png
Это код для макетов, я использую фрагменты и заменяю их на макетах фреймов, потому что тест требует от меня этого.
- основной макет действия
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity"
android:background="@color/colorBlack">
<FrameLayout
android:id="@+id/section1"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
>
</FrameLayout>
<FrameLayout
android:orientation="vertical"
android:id="@+id/section2"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
>
</FrameLayout>
</LinearLayout>
----section1 and section2 code are the same
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context="fragments.SectionOne"
android:background="#f2f2f2">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:id="@+id/recyclerView"
android:orientation="horizontal">
</androidx.recyclerview.widget.RecyclerView>
</LinearLayout>
Если использовать scrollview и обернуть все это в один фрейм-макет, оба раздела перекрывают друг друга
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity"
android:background="@color/colorBlack">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<FrameLayout
android:id="@+id/section1"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
>
</FrameLayout>
<FrameLayout
android:orientation="vertical"
android:id="@+id/section2"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
>
</FrameLayout>
</FrameLayout>
</ScrollView>