2015-04-24 11 views
6

Ich benutze Android-Bibliothek Android-ObservableScrollView von ksoichiro. Ich benutze sein Beispiel Flexible Space mit Viewpager und ich modifiziere es. Aber es gibt ein Problem. Sie können sehen, in meinem Xml gibt es 2 Android: FitsSystemWindows. Eins in LinearLayout und das andere in Toolbar. In LinearLayout funktioniert gut. aber in der Symbolleiste funktioniert nicht. Warum das passieren? Danke. Sorry für mein schlechtes Englischandroid: fitsSystemWindows funktioniert nicht auf Toolbar

Theres meine xml-Code:

<FrameLayout 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="match_parent"> 

<com.github.ksoichiro.android.observablescrollview.TouchInterceptionFrameLayout 
    android:id="@+id/container" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <ImageView 
     android:id="@+id/image" 
     android:layout_width="match_parent" 
     android:layout_height="@dimen/flexible_background" 
     android:scaleType="centerCrop" 
     android:src="@drawable/bridge" /> 

    <View 
     android:id="@+id/overlay" 
     android:layout_width="match_parent" 
     android:layout_height="@dimen/flexible_background" 
     android:background="?attr/colorPrimary" /> 

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

     <FrameLayout 
      android:id="@+id/header" 
      android:layout_width="match_parent" 
      android:layout_height="@dimen/flexible_height"> 

      <TextView 
       android:id="@+id/title" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       android:layout_gravity="bottom" 
       android:layout_margin="@dimen/abc_action_bar_default_padding_material" 
       android:ellipsize="end" 
       android:gravity="center_vertical" 
       android:maxLines="1" 
       android:minHeight="?attr/actionBarSize" 
       android:textColor="@android:color/white" 
       android:textSize="20sp" /> 
     </FrameLayout> 

     <com.bright.nongkrongyuk.ui.SlidingTabLayout 
      android:id="@+id/sliding_tabs" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="bottom" 
      android:background="@android:color/black" 
      app:sliding_textColor="@drawable/sliding_tab_profile" /> 

     <android.support.v4.view.ViewPager 
      android:id="@+id/pager" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@android:color/background_light" /> 
    </LinearLayout> 
</com.github.ksoichiro.android.observablescrollview.TouchInterceptionFrameLayout> 

<android.support.v7.widget.Toolbar 
    android:id="@+id/toolbar" 
    android:layout_width="match_parent" 
    android:layout_height="?attr/actionBarSize" 
    android:background="@android:color/transparent" 
    android:minHeight="?attr/actionBarSize" 
    android:fitsSystemWindows="true" /> 
</FrameLayout> 

Antwort

12

Das android:fitsSystemWindows Attribut legt eine Polsterung. Dies bedeutet, dass die Anpassung für die untergeordneten Ansichten gilt. Sie würden dies entweder auf Ihre FrameLayout beantragen oder die Toolbar in ein verschachteltes Layout

setzen Es ist wirklich schwierig ein richtiges Vollbild-Layout mit Blick auf den Bildschirm ausgestattet zu machen. Ich habe Fragment fragmentiert, wo ich eine Inhaltsansicht deklarieren kann, die je nach Status- und/oder Navigationsleiste

aufgefüllt wird
Verwandte Themen