I have troubles with scrollview and nestedscrollview. I try to make a view where on the top there is a map and below the google map there is a expandable listview. And I want to scroll through the whole view so it's like that the google map is a part of the expandablelistview.
My xml looks like that
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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"
android:id="@+id/htab_maincontent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"
android:theme="@style/WizyGeneralTheme"
tools:context=".fragments.ShoppingFragment">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.gms.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="200dp"
/>
<ExpandableListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/elv_shops"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="false"
android:groupIndicator="@null"
android:background="@color/white"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
I tried to use a scrollview and in this code snippet a nestedscrollview but both didn't work. When i say that nestedScrollingEnabled=true at the expandablelistview only the listview scrolls but not the map. Do you have any idea how to solve this? By the way, I have a similar view but there I use a recyclerview instead of the expandablelistview and this works fine. So, I think the main problem is the expandablelistview but I can't replace this because my listview has to expand. Or is there any possibility to bypass the expandablelistview?
Maybe you need also the layout files from my item in the expandablelistview Group Item:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/section_shop_group"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white">
<ImageView
android:id="@+id/iv_shop"
android:layout_width="140dp"
android:layout_height="140dp"
android:src="@mipmap/img_default"
android:scaleType="centerCrop"
android:layout_alignParentStart="true"/>
<RatingBar
android:id="@+id/rb_shop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:isIndicator="true"
android:scaleX="1"
android:scaleY="1"
android:transformPivotX="0dp"
android:transformPivotY="0dp"
android:layout_marginVertical="15dp"
android:layout_marginHorizontal="15dp"
android:numStars="5"
android:stepSize="0.1"
android:theme="@style/WizyGeneralTheme.RatingBar"/>
<TextView
android:id="@+id/tv_shop_name"
android:layout_toRightOf="@id/iv_shop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="2"
android:ellipsize="end"
android:textStyle="bold"
android:textSize="18dp"
android:textColor="@color/black"
android:layout_marginHorizontal="15dp"
android:layout_marginTop="15dp"/>
<TextView
android:id="@+id/tv_shop_address"
android:layout_below="@id/tv_shop_name"
android:layout_toRightOf="@id/iv_shop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="2"
android:ellipsize="end"
android:textSize="15dp"
android:layout_marginHorizontal="15dp"/>
<TextView
android:id="@+id/tv_shop_pricing"
android:layout_toRightOf="@id/iv_shop"
android:layout_alignParentBottom="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="15dp"
android:layout_marginVertical="15dp"
android:text="$$$$"
android:textColor="@color/blue"
/>
<ImageView
android:id="@+id/ivGroupIndicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/group_indicator"
android:backgroundTint="@color/grey"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"/>
</RelativeLayout>
Group Detail (expanded part):
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/section_shop_detail"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:padding="10dp">
<TextView
android:id="@+id/tv_opening_hours"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageButton
android:id="@+id/btn_shop_website"
android:layout_toLeftOf="@id/btn_shop_route"
android:layout_width="30dp"
android:layout_height="30dp"
android:scaleType="fitCenter"
android:background="@drawable/rectangle_round_corners"
android:backgroundTint="@color/white"
android:src="@mipmap/ic_website"
android:tint="@color/blue"
android:layout_marginHorizontal="10dp"
android:onClick="onShoppingWebsiteButtonClicked"/>
<ImageButton
android:id="@+id/btn_shop_route"
android:layout_width="30dp"
android:layout_height="30dp"
android:scaleType="fitCenter"
android:background="@drawable/rectangle_round_corners"
android:backgroundTint="@color/white"
android:src="@mipmap/ic_navigation"
android:tint="@color/blue"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_marginHorizontal="10dp"
android:onClick="onShoppingMapsButtonClicked"/>
</RelativeLayout>