35

First Image Second image Third imagebố trí sụp đổ Toolbar có in logo, tiêu đề, phụ đề trong thanh công cụ

Tôi muốn làm điều này nhưng với Việc thu gọn bố trí thanh công cụ hoặc hiển thị các biểu tượng và tiêu đề trong thanh công cụ sau khi di chuyển.

<!-- Toolbars --> 
<android.support.design.widget.AppBarLayout 
    android:id="@+id/appbar" 
    android:layout_width="match_parent" 
    android:layout_height="@dimen/detail_backdrop_height" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
    android:fitsSystemWindows="true"> 

    <android.support.design.widget.CollapsingToolbarLayout 
     android:id="@+id/collapsing_toolbar_layout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_scrollFlags="scroll|exitUntilCollapsed" 
     app:contentScrim="?attr/colorPrimary" 
     app:expandedTitleMarginStart="48dp" 
     app:expandedTitleMarginEnd="64dp" 
     android:fitsSystemWindows="true"> 

     <ImageView 
      android:id="@+id/background_image" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:scaleType="centerCrop" 
      android:src="@drawable/background_1" 
      app:layout_collapseMode="parallax" 
      android:fitsSystemWindows="true"/> 

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

      <ImageView 
       android:id="@+id/avatar_image" 
       android:layout_width="@dimen/circular_image_avatar" 
       android:layout_height="@dimen/circular_image_avatar" 
       android:gravity="center" 
       android:scaleType="centerCrop" 
       android:src="@drawable/ic_placerholder" 
       android:layout_centerVertical="true" 
       android:layout_centerHorizontal="true" 
       android:transitionName="image_toolbar"/> 

      <TextView 
       android:id="@+id/profile_title" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:text="Name title" 
       android:textAlignment="center" 
       android:layout_marginTop="@dimen/item_padding_top_bottom" 
       android:gravity="center" 
       style="@style/titleText_toolbar" 
       android:layout_below="@+id/avatar_image" 
       android:transitionName="title_toolbar"/> 
      <TextView 
       android:id="@+id/profile_subtitle" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:text="Subtitle" 
       android:textAlignment="center" 
       android:gravity="center" 
       style="@style/captionText_toolbar" 
       android:layout_below="@+id/profile_title" /> 

     </RelativeLayout> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_height="?attr/actionBarSize" 
      android:layout_width="match_parent" 
      app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
      app:layout_collapseMode="pin"> 

      <!-- avatar image and title, subtitle --> 

     </android.support.v7.widget.Toolbar> 

    </android.support.design.widget.CollapsingToolbarLayout> 

</android.support.design.widget.AppBarLayout> 

Xin hãy giúp tôi

+0

Bạn đã thử mã nào? Bạn đang gặp phải vấn đề gì? Mô tả nó nhiều hơn và chúng tôi sẽ (có thể) giúp đỡ. –

+0

http://i.imgur.com/Yj7pe5Y.jpg http://i.imgur.com/AUVokgc.jpg http://i.imgur.com/dqWq3Fp.jpg Xin lỗi tôi không có 10 danh tiếng cho hình ảnh bài viết: ( – tonilopezmr

+0

Mã không liên quan trong trường hợp này, tôi muốn biết làm thế nào để làm điều đó – tonilopezmr

Trả lời

2

mịn-app-thanh-layout

thấy Example

Lắp đặt

compile "me.henrytao:smooth-app-bar-layout:<latest-version>" 

enter image description here

enter image description here

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