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儿童在使用它之前重新调整你的位图