2016-07-15 3 views
0

Ich habe eine ScrollView auf meiner Seite, aber leider erlaubt es mir nicht, andere Tasten wie die obere rechte und die obere linke Taste zu drücken, um auf die Navigationsschubladen zuzugreifen. Dies geschieht zu jeder Zeit auf der Seite. Wenn ich nach unten scrolle, funktioniert nichts auf der Seite selbst, also kann ich keine Taste drücken oder die Google Maps API verwenden.Android: ScrollView deaktiviert alle Tasten und Navigation

Ich weiß, dass dieses Problem mit der ScrollView verknüpft ist, weil ich 3 Aktivitäten in meiner App, die ScrollView verwenden, und sie sind die einzigen, wo dieses Problem ist.

Hier ist ein Screenshot, der helfen könnte: Der Inhalt meiner aktuellen Ansicht überlappt die Navigationsleiste, was das Problem erklären könnte.

overlapping http://image.prntscr.com/image/1a01553c66ae46ffad28f4c64707eb88.png

Hier ist das XML-Layout:

activity_produit_detail.xml

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout 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/drawer_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true" 
tools:openDrawer="start"> 

<include 
    layout="@layout/app_bar_produit_detail" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" /> 

<android.support.design.widget.NavigationView 
    android:id="@+id/nav_view" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    android:fitsSystemWindows="true" 
    app:headerLayout="@layout/nav_header_main" 
    app:menu="@menu/activity_main_drawer" /> 

app_bar_produit_detail.xml

<?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:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true" 
tools:context="com.example.adam_jaamour.cfimmobilier.Produits.ProduitDetail"> 

<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/AppTheme.AppBarOverlay"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="?attr/colorPrimary" 
     app:popupTheme="@style/AppTheme.PopupOverlay" /> 

</android.support.design.widget.AppBarLayout> 

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

content_produit_detail.xml

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:fillViewport="true"> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin"> 

    <!-- TITLE --> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="50dp" 
     android:orientation="horizontal" 
     android:weightSum="1"> 

     <TextView 
      android:id="@+id/txt_detail_title" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:layout_gravity="fill" 
      android:layout_weight="1" 
      android:text="title" 
      android:textColor="#101f34" 
      android:textSize="20dp" 
      android:textStyle="normal|bold" /> 

     <Button 
      android:id="@+id/button_detail_heart" 
      android:layout_width="39dp" 
      android:layout_height="wrap_content" 
      android:background="?android:attr/selectableItemBackground" 
      android:drawableStart="@drawable/ic_star_border" /> 

    </LinearLayout> 

    <View 
     android:layout_width="match_parent" 
     android:layout_height="1dp" 
     android:layout_marginTop="15dp" 
     android:background="#FF000000" /> 

    <!-- RECYCLER VIEW --> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_marginTop="15dp" 
     android:orientation="vertical"> 

     <ImageView 
      android:id="@+id/content_product_detail_recycer_view_cur_image" 
      android:layout_width="150dp" 
      android:layout_height="130dp" 
      android:layout_gravity="center" 
      android:background="@android:color/black" /> 

     <android.support.v7.widget.RecyclerView 
      android:id="@+id/content_product_detail_recycer_view" 
      android:layout_width="wrap_content" 
      android:layout_height="60dp" 
      android:layout_gravity="center" 
      android:layout_margin="5dp" 
      android:background="@android:color/darker_gray"> 

     </android.support.v7.widget.RecyclerView> 

    </LinearLayout> 

    <View 
     android:layout_width="match_parent" 
     android:layout_height="1dp" 
     android:layout_marginTop="15dp" 
     android:background="#FF000000" /> 

    <!-- TITLE --> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="15dp" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/txt_detail_price" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="left" 
      android:text="price" 
      android:textColor="#000000" 
      android:textSize="16sp" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/txt_detail_total_area_top" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="right" 
      android:text="area" 
      android:textColor="#000000" 
      android:textSize="16sp" 
      android:textStyle="bold" /> 
    </LinearLayout> 

    <!-- IMAGES SCROLLABLE --> 


    <!-- DESCRIPTION --> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="15dp" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/txt_detail_description" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="left" 
      android:text="description" 
      android:textColor="#000000" 
      android:textStyle="italic" /> 
    </LinearLayout> 

    <View 
     android:layout_width="match_parent" 
     android:layout_height="1dp" 
     android:layout_marginTop="15dp" 
     android:background="#FF000000" /> 

    <!-- REFERENCE --> 
    <LinearLayout 
     android:id="@+id/content_produit_detail_linear_layout_reference" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="5dp" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/textView100" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="left" 
      android:text="@string/content_produit_detail_ref" 
      android:textColor="#1b5cb4" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/txt_detail_ref" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="right" 
      android:text="null" 
      android:textColor="#000000" /> 
    </LinearLayout> 

    <!-- TYPE --> 
    <LinearLayout 
     android:id="@+id/content_produit_detail_linear_layout_type" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="3dp" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/textView101" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="left" 
      android:text="@string/content_produit_detail_type" 
      android:textColor="#1b5cb4" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/txt_detail_type" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="right" 
      android:text="null" 
      android:textColor="#000000" /> 
    </LinearLayout> 

    <!-- NUMBER OF ROOMS --> 
    <LinearLayout 
     android:id="@+id/content_produit_detail_linear_layout_nb_rooms" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="3dp" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/textView102" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="left" 
      android:text="@string/content_produit_detail_nb_rooms" 
      android:textColor="#1b5cb4" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/txt_detail_nb_rooms" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="right" 
      android:text="null" 
      android:textColor="#000000" /> 
    </LinearLayout> 

    <!-- TOTAL AREA --> 
    <LinearLayout 
     android:id="@+id/content_produit_detail_linear_layout_total_area_detail" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="3dp" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/textView103" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="left" 
      android:text="@string/content_produit_detail_total_area" 
      android:textColor="#1b5cb4" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/txt_detail_total_area" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="right" 
      android:text="null" 
      android:textColor="#000000" /> 
    </LinearLayout> 

    <!-- LIVING AREA --> 
    <LinearLayout 
     android:id="@+id/content_produit_detail_linear_layout_area_living" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="3dp" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/textView104" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="left" 
      android:text="@string/content_produit_detail_living_area" 
      android:textColor="#1b5cb4" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/txt_detail_living_area" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="right" 
      android:text="null" 
      android:textColor="#000000" /> 
    </LinearLayout> 

    <!-- TERRACE AREA --> 
    <LinearLayout 
     android:id="@+id/content_produit_detail_linear_layout_area_terrace" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="3dp" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/textView105" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="left" 
      android:text="@string/content_produit_detail_terrace_area" 
      android:textColor="#1b5cb4" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/txt_detail_terrace_area" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="right" 
      android:text="null" 
      android:textColor="#000000" /> 
    </LinearLayout> 

    <!-- BUILDING --> 
    <LinearLayout 
     android:id="@+id/content_produit_detail_linear_layout_building" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="3dp" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/textView106" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="left" 
      android:text="@string/content_produit_detail_building" 
      android:textColor="#1b5cb4" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/txt_detail_building" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="right" 
      android:text="null" 
      android:textColor="#000000" /> 
    </LinearLayout> 

    <!-- DISTRICT --> 
    <LinearLayout 
     android:id="@+id/content_produit_detail_linear_layout_district" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="3dp" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/textView107" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="left" 
      android:text="@string/content_produit_detail_district" 
      android:textColor="#1b5cb4" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/txt_detail_district" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="right" 
      android:text="null" 
      android:textColor="#000000" /> 
    </LinearLayout> 

    <!-- CITY --> 
    <LinearLayout 
     android:id="@+id/content_produit_detail_linear_layout_city" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="3dp" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/textView1070" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="left" 
      android:text="Ville:" 
      android:textColor="#1b5cb4" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/txt_detail_city" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="right" 
      android:text="null" 
      android:textColor="#000000" /> 
    </LinearLayout> 

    <!-- COUNTRY --> 
    <LinearLayout 
     android:id="@+id/content_produit_detail_linear_layout_country" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="3dp" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/textView10700" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="left" 
      android:text="Country:" 
      android:textColor="#1b5cb4" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/txt_detail_country" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="right" 
      android:text="null" 
      android:textColor="#000000" /> 
    </LinearLayout> 

    <!-- NUM PARKING --> 
    <LinearLayout 
     android:id="@+id/content_produit_detail_linear_layout_parking" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="3dp" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/textView1071" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="left" 
      android:text="@string/content_produit_detail_parking" 
      android:textColor="#1b5cb4" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/txt_detail_parking" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="right" 
      android:text="null" 
      android:textColor="#000000" /> 
    </LinearLayout> 

    <!-- NUM CELLAR --> 
    <LinearLayout 
     android:id="@+id/content_produit_detail_linear_layout_cellar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="3dp" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/textView1073" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="left" 
      android:text="@string/content_produit_detail_cellar" 
      android:textColor="#1b5cb4" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/txt_detail_cellar" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:gravity="right" 
      android:text="null" 
      android:textColor="#000000" /> 
    </LinearLayout> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_marginTop="15dp" 
     android:gravity="center_horizontal" 
     android:orientation="horizontal"> 

     <Button 
      android:id="@+id/content_product_detail_btn_mailCurProd" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginRight="20dp" 
      android:background="?android:attr/selectableItemBackground" 
      android:drawableRight="@drawable/ic_mail" 
      android:text="@string/content_produit_detail_button_send_product" /> 

     <Button 
      android:id="@+id/content_product_detail_btn_mailAgency" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:background="?android:attr/selectableItemBackground" 
      android:drawableRight="@drawable/ic_contact_mail" 
      android:text="@string/content_produit_detail_button_send_info_agency" /> 
    </LinearLayout> 

    <View 
     android:layout_width="match_parent" 
     android:layout_height="1dp" 
     android:layout_marginTop="15dp" 
     android:background="#FF000000" /> 

    <fragment 
     android:id="@+id/content_product_detail_gmaps" 
     android:name="com.google.android.gms.maps.MapFragment" 
     android:layout_width="match_parent" 
     android:layout_height="250dip" 
     android:layout_margin="10dp" /> 


</LinearLayout> 

</ScrollView> 

Vielen Dank im Voraus für jeden, der helfen könnte.

Antwort

1

Ersetzen Sie Ihre Scroll Linien mit unter:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

Und wenn möglich, versuchen NestedScrollView zu verwenden anstelle von Scroll

+0

Danke, das das Problem behoben haben! –

+1

:) Happy Coding. – Drv