2017-01-06 4 views
1

je le fichier xml avec CoordinatorLayoutblanc inactif espace en bas sur CoordinatorLayout

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 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:orientation="vertical" 
    android:visibility="visible" 
    android:gravity="center_horizontal"> 
      <android.support.design.widget.CoordinatorLayout 
       xmlns:android="http://schemas.android.com/apk/res/android" 
       xmlns:app="http://schemas.android.com/apk/res-auto" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"> 
       <android.support.design.widget.AppBarLayout 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
        android:layout_marginStart="4dp" 
        android:layout_marginEnd="4dp" 
        android:layout_marginLeft="4dp" 
        android:layout_marginRight="4dp"> 
        <android.support.design.widget.TabLayout 
         android:id="@+id/tabLayout" 
         app:tabBackground="@drawable/my_tab_item_bg_selector" 
         app:tabMaxWidth="0dp" 
         app:tabGravity="fill" 
         app:tabMode="fixed" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" /> 
       </android.support.design.widget.AppBarLayout> 
       <android.support.v4.view.ViewPager 
        android:id="@+id/viewPager" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        app:layout_behavior="@string/appbar_scrolling_view_behavior"/> 
      </android.support.design.widget.CoordinatorLayout> 
</LinearLayout> 

Et j'ai un autre fichier XML que je mets sur la disposition du coordonnateur

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.NestedScrollView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/nestedScrollData" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior"> 
    <LinearLayout 
     android:id="@+id/layoutDataDispatchContacts" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     android:gravity="center_horizontal"> 

     <LinearLayout 
      android:id="@+id/layoutFullTableDispatchContacts" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" 
      android:gravity="center_horizontal" 
      android:background="@drawable/layout_block_background"> 
      <LinearLayout 
       android:id="@+id/tableLinearLayoutDispatchContacts" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:orientation="vertical" 
       android:gravity="center_horizontal"> 
      </LinearLayout> 
     </LinearLayout> 
    </LinearLayout> 
</android.support.v4.widget.NestedScrollView> 

J'attrapant bug de l'espace vide , qui couvre la partie de ma fenêtre et non cliquable. C'est sur la capture d'écran ci-dessous: unclickable inactive bottom space J'ai remarqué que lorsque je supprime l'application: layout_behavior = "@ string/appbar_scrolling_view_behavior" de mon ViewPager, le bogue disparaît. Mais mes noms d'onglets disparaissent aussi. Je pense que cela crée une barre d'outils invisible ou quelque chose comme ça.

+0

n'est-ce pas l'espace blanc de 'layoutBottom' dans votre cas? –

+0

non, j'ai changé le code, enlevé inutile –

+0

J'ai trouvé une solution stupide. –

Répondre

1

Comme CoordinatorLayout travaille en tant que parent de subviews donc, d'occuper plein écran, vous devez définir la hauteur pour correspondre parent au lieu de wrap_content comme ceci:

android: layout_height = "match_parent"

et cela fonctionnerait bien.