0

我們在我們的應用程序中有一個工具欄,我必須在下面添加座標佈局。 因爲我們有一個圖像,在下面我們有一個標籤,最後在下面我們有一個帶有列表視圖的View-pager。問題在座標佈局和動畫頂部添加空間不是那麼順利

基本上我想這樣做如下: -

  1. 當我們向上滾動的圖像需要向上滾動,並在標籤下面粘到工具欄和列表項都顯示出下面的標籤。

但同時努力我現在面臨的以下問題: -

  1. 一個額外的空間加上了協調佈局的頂部。
  2. 的動畫不流暢,同時向上滾動

    <android.support.design.widget.AppBarLayout 
        android:id="@+id/appBarLayout_tour_series" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:background="@android:color/white" 
    
        > 
    
        <android.support.design.widget.CollapsingToolbarLayout 
         android:id="@+id/collapsing_toolbar_player_stats" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         app:contentInsetStartWithNavigation="0dp" 
         app:contentScrim="@android:color/white" 
         app:layout_scrollFlags="scroll|exitUntilCollapsed" 
         > 
    
         <au.com.cricket.util.DynamicNetworkImageView 
          android:id="@+id/series_header_bg" 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          android:adjustViewBounds="true" 
          android:fitsSystemWindows="true" 
          android:scaleType="centerCrop" 
          /> 
    
         <RelativeLayout 
          android:id="@+id/series_header" 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          android:fitsSystemWindows="true" 
          > 
    
          <au.com.cricket.util.FadeInNetworkImageView 
           android:id="@+id/img_team_logo" 
           android:layout_width="72dp" 
           android:layout_height="72dp" 
           android:layout_centerHorizontal="true" 
           android:layout_marginTop="18dp" 
           android:scaleType="centerCrop" 
           tools:ignore="ContentDescription"/> 
    
    
          <com.outware.common.ui.widget.OMTextView 
           android:id="@+id/txt_series_name" 
           style="@style/Home.Text.MatchDetail.TeamName" 
           android:layout_width="wrap_content" 
           android:layout_height="wrap_content" 
           android:layout_below="@+id/img_team_logo" 
           android:layout_centerHorizontal="true" 
           android:lineSpacingMultiplier="1.2" 
           android:paddingLeft="80dp" 
           android:paddingRight="80dp" 
           android:paddingTop="10dp" 
           android:text="KFC BBL|05" 
           android:textColor="@color/color_charcoal_black" 
           android:textSize="18sp" 
           custom:customFont="TabletGothicNarrow-Bold.otf" 
           tools:ignore="HardcodedText" 
           /> 
    
          <com.outware.common.ui.widget.OMTextView 
           android:id="@+id/txt_match_status" 
           style="@style/Home.Text.MatchDetail.TeamName" 
           android:layout_width="wrap_content" 
           android:layout_height="wrap_content" 
           android:layout_below="@id/txt_series_name" 
           android:layout_centerHorizontal="true" 
           android:bufferType="spannable" 
           android:gravity="center_horizontal" 
           android:paddingBottom="12dp" 
           android:text="date range" 
           android:textColor="@color/text_home_grey" 
           android:textSize="11sp" 
           custom:customFont="TabletGothic.otf" 
           tools:ignore="HardcodedText" 
    
           /> 
    
          <ImageView 
           android:id="@+id/notify_icon" 
           android:layout_width="40dp" 
           android:layout_height="40dp" 
           android:layout_alignParentRight="true" 
           android:layout_below="@+id/txt_match_status" 
           android:layout_centerVertical="true" 
           android:src="@drawable/ic_fixtures_notify_series" 
           android:visibility="gone" 
           tools:ignore="ContentDescription" 
           /> 
         </RelativeLayout> 
    
    
        </android.support.design.widget.CollapsingToolbarLayout> 
    
    </android.support.design.widget.AppBarLayout> 
    
    
    <android.support.v4.widget.NestedScrollView 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:fillViewport="true" 
        app:layout_behavior="@string/appbar_scrolling_view_behavior" 
        > 
    
    
        <include layout="@layout/fragment_tab_series_layout"/> 
    
    
    </android.support.v4.widget.NestedScrollView> 
    

現在我能夠解決關於頂部空間的第一個問題但無法像平滑動畫那樣修復它直到我們向上滾動時滯後。

另外還有一個問題,我觀察到可摺疊佈局並沒有完全摺疊,因爲一旦我們向上滾動時就看到了一些佈局佈局的下部分。 我更新了上面的代碼。請檢查。

Screehshot: -

enter image description here

+0

因爲您在協調器佈局中填充的圖像,動畫不平滑嘗試使用低質量圖像或重新縮放圖像beofre使用它 –

+0

@AdeelTurk:現在我可以將第一個問題解決爲頂部欄中的空間被刪除,但我面臨另一個問題我可摺疊佈局不能完全摺疊。如在底部,當我們向上滾動時,頭部下部的一部分是可見的。 –

回答

0

我有一個樣品project幾乎相同的用戶界面它可能會幫助你,我會建議使用一些低質量的圖像或coordianatorlayout兒童在使用它之前重新調整你的位圖