2015-04-24 53 views
6

Tôi đang sử dụng thư viện Android Android-ObservableScrollView từ ksoichiro. Tôi sử dụng mẫu không gian linh hoạt của mình với viewpager và tôi sửa đổi nó. Nhưng có một số vấn đề. Bạn có thể thấy trong xml của tôi có 2 android: fitsSystemWindows. Một trong LinearLayout và một trong Thanh công cụ. Trong LinearLayout hoạt động tốt. nhưng trong Thanh công cụ không hoạt động. Tại sao điều này xảy ra? Cảm ơn bạn. Xin lỗi vì tiếng anh xấuandroid: fitsSystemWindows không hoạt động trên Thanh công cụ

theres mã XML my my:

<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> 

Trả lời

12

Các android:fitsSystemWindows thuộc tính thiết lập một đệm. Điều này có nghĩa là sự phù hợp áp dụng cho các chế độ xem con. Bạn sẽ phải áp dụng điều này vào số FrameLayout hoặc đặt Toolbar vào một số lồng nhau Layout

Thật là khó để tạo bố cục toàn màn hình phù hợp với chế độ xem được gắn với màn hình. Tôi phân lớp Fragment nơi tôi có thể tuyên bố một nội dung-view mà sẽ nhận được padding tùy thuộc vào Status- và/hoặc Navigationbar

Các vấn đề liên quan