2017-12-22 4 views
0

Ich habe BottomSheet in Android verwendet, die ein MapView darin enthält und einen EditText, um Daten zu suchen.BottomSheet Fokus Problem

Jetzt funktioniert Map und BottomSheet Verhalten gut, bis SoftKeyboard nicht geöffnet ist, d. H. Karte scrollt wie Charme.

Die Ausgabe ist, dass, wenn Softkeyboard offen ist und ich versuche Karte von oben nach unten mit einigen harten Blättern zu bewegen, BottomSheet (Zustand versteckt) geschlossen zu werden, die nicht in dem Fall, wenn SofKeyboard nicht geöffnet ist.

Was könnte die Lösung sein, um zu vermeiden, BottomSheet beim Scrollen der Karte nach unten zu öffnen während, Sofekeyboard geöffnet ist.

Danke.

EDIT

Das Layout, die BottomSheet enthält, ist wie unter dem TabLayout hat und es enthält drei Fragmente in ihr und Karte ist in erstem Fragmente:

<?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> 
+0

Post Layout – ADM

+0

ok lassen Sie mich bearbeiten .. –

+0

@ADM hinzugefügt Hauptfragment, das BottomSheet hat, innerhalb viewpager ersetzt Fragment, das Karte enthält. –

Antwort

0

Machen Sie Ihre Wurzel MapView als 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> 
+1

Korrekte Antwort ist bereits in Kommentar von @ADM :) –

+1

Nach akzeptierter Antwort kann diese Frage in Markierung (Duplikat von) verwendet werden. Deshalb fragte ich nach.Thx – ADM