I am working on a project where I use GoogleMap (v2) and Recyclerview (and a bunch of other views). When the app is in portrait mode, (showing map on top, and a recyclerview below), I want it to be possible to "drag" the intersection between the recyclerview and the map, so the map can be higher/lower (and the recyclerview height adjusts accordingly).
In principle, my layout is like this:
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/fragmentBackgroundColor">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_margin="4dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- other views in same level here , not essentially for the Q-->
<com.google.android.gms.maps.MapView
android:id="@+id/fragment_home_map_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:liteMode="false"
app:mapType="hybrid" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<include
android:id="@+id/fragment_home_info_card_car_position"
layout="@layout/info_card_car_position"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
tools:visibility="visible"
android:visibility="visible" />
<include
android:id="@+id/fragment_home_filter_chips"
layout="@layout/selection_chips"
app:layout_constraintTop_toBottomOf="@id/fragment_home_info_card_car_position"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:background="?android:attr/listDivider"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
android:layout_weight="1">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/fragment_home_swiper_refresh_layout"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/fragment_home_divider_2"
android:layout_width="match_parent"
android:layout_height="0dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/fragment_home_recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fadeScrollbars="false"
android:scrollbars="vertical"
android:scrollbarSize="4dp"
android:scrollbarStyle="outsideOverlay"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/list_item_order_list"/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<View
app:layout_constraintBottom_toTopOf="@id/fragment_home_bottom_navigation"
android:layout_marginBottom="4dp"
android:id="@+id/fragment_home_divider_2"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"/>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/fragment_home_bottom_navigation"
style="@style/Widget.MaterialComponents.BottomNavigationView.Colored"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:menu="@menu/bottom_navigation_view_menu"
app:layout_constraintBottom_toBottomOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.appcompat.widget.LinearLayoutCompat>
</layout>
In the middle between the map and the recyclerview, there are two included views which could be used as drag handler (touch and drag them up/down).
I hope for (and haven't found any yet) some kind if gesture handler I could wrap around those two to make them draggable up/down and resize both map and recyclerview, and leave the other as they are (and let them adjust if needed).
Or do you have any other good suggestions.