0

I have used BottomSheet in Android which contains a MapView inside it and an EditText to search data.

Now, Map and BottomSheet behavior working fine until SoftKeyboard is not open, i.e. Map scrolling like charm.

The Issue is that When SoftKeyboard is open and I am trying to scroll map from top to bottom with some hard scroll, BottomSheet getting closed(state to hidden) which is not in the case when SofKeyboard is not open.

What might be the solution to avoid BottomSheet to get closed when scrolling the map to down while, SofeKeyboard is open.

Thanks.

EDIT

The layout which contains BottomSheet is as below which has TabLayout and it contains Three Fragments in it and map is in first fragment :

<?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"
    android:id="@+id/parentView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clickable="true"
    android:focusableInTouchMode="true" >

    <RelativeLayout
        android:id="@+id/rltBottomSheet"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clipToPadding="true"
        android:paddingTop="@dimen/size_10"
        app:layout_behavior="@string/view_pager_bottom_sheet_behavior">

        <include layout="@layout/view_bottom_sheet_bg" />

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

            <RelativeLayout
                android:id="@+id/rltHeader"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <ImageView
                    android:id="@+id/imgBackAll"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerHorizontal="true"
                    android:layout_marginBottom="@dimen/size_10"
                    android:padding="@dimen/size_15"
                    android:src="@drawable/ic_back_all" />

                <ImageView
                    android:id="@+id/img"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:layout_centerVertical="true"
                    android:layout_marginLeft="@dimen/size_10"
                    android:padding="@dimen/size_5"
                    android:src="@drawable/ic_add_gym" />

            </RelativeLayout>

            <android.support.design.widget.TabLayout
                android:id="@+id/tabLayout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/imgLogo"
                android:minHeight="?attr/actionBarSize"
                app:tabGravity="fill"
                app:tabIndicatorColor="@color/tab_indicator_color"
                app:tabIndicatorHeight="@dimen/size_2"
                app:tabMode="fixed"
                app:tabSelectedTextColor="@color/explore_tab_text_color"
                app:tabTextAppearance="@android:style/TextAppearance.Widget.TabWidget"
                app:tabTextColor="@color/explore_tab_text_color" />

            <android.support.v4.view.ViewPager
                android:id="@+id/vp"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_below="@+id/tabLayout" />

        </LinearLayout>

        <View
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:layout_alignParentBottom="true"
            android:alpha="0.5"
            android:background="@drawable/ic_bottom_overlay"
            android:visibility="gone"/>

    </RelativeLayout>

</android.support.design.widget.CoordinatorLayout>
  • Post your layout – ADM Dec 22 '17 at 06:26
  • ok let me edit.. –  Dec 22 '17 at 06:29
  • @ADM added main fragment which has BottomSheet, inside viewpager replacing fragment which contains map. –  Dec 22 '17 at 06:35
  • Does your view_bottom_sheet_bg contain `NestedScrollView`? If not try after adding . – ADM Dec 22 '17 at 06:36
  • It contains ScrollView instead of Nested... –  Dec 22 '17 at 06:39
  • Make it Nested and then check . – ADM Dec 22 '17 at 06:39
  • @ADM Done. NestedScrollView solved it. Thanks. –  Dec 22 '17 at 06:42
  • Well played .. Thx – ADM Dec 22 '17 at 06:43
  • What about putting clusters above the ==>Current location circle on Googlemap ? Since am using Clustering my clusters coming back of current location circle and due to it, cluster on current location is hiding back of current location circle. Note : I know this should be new question. ;) –  Dec 22 '17 at 06:58
  • This should be new question i guess need more explanation . With images . – ADM Dec 22 '17 at 06:59
  • you can go through : https://stackoverflow.com/questions/42666144/cluster-markers-overlay-by-users-current-location-icon-in-android/42869111 and i dont want to use custom circle marker. thanks. –  Dec 22 '17 at 07:09
  • I have gone thorough this link . But did not get much . You probably post a new question it will show in newest queue and someone will answer. Pls Accept my answer below as its helped you .Thx – ADM Dec 22 '17 at 07:27

1 Answers1

0

Make your root of MapView as NestedScrollView.

 <android.support.v4.widget.NestedScrollView
    android:layout_width="wrap_content"
    android:layout_height="match_parent">

    // Your content goes here
</android.support.v4.widget.NestedScrollView>
ADM
  • 20,406
  • 11
  • 52
  • 83
  • 1
    After accepted answer this question can be use in marking (duplicate of ) . Thats why i asked for.Thx – ADM Dec 22 '17 at 07:32