2015-07-10 85 views
0

任何人都知道如何在使用CollapsingToolbarLayout時在標題下添加信息?CollapsingToolbarLayout信息涵蓋標題

我使用mCollapsingToolbarLayout.setTitle(myTitle)設置標題,您可以在屏幕截圖中看到它。在佈局中,我還設置了其他一些東西(評級和類別)。正如你所看到的,標題是在額外的信息後面。有誰知道一個很好的方法來解決這個問題?謝謝!

屏幕截圖: enter image description here

這是我的佈局文件:

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:id="@+id/drawer_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="?attr/background"> 
<!-- The main content view --> 

<android.support.design.widget.CoordinatorLayout 
    android:id="@+id/coordinator_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <android.support.design.widget.AppBarLayout 
     android:id="@+id/appbar" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

     <android.support.design.widget.CollapsingToolbarLayout 
      android:id="@+id/collapsing_toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      app:collapsedTitleTextAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title" 
      app:contentScrim="?attr/colorPrimary" 
      app:layout_scrollFlags="scroll|exitUntilCollapsed"> 

      <ImageView 
       android:id="@+id/iv_detailHeaderImage" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:adjustViewBounds="true" 
       app:layout_collapseMode="parallax" 
       app:layout_collapseParallaxMultiplier="1.0" /> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_gravity="bottom" 
       android:background="?attr/colorPrimary" 
       android:gravity="bottom" 
       android:orientation="vertical"> 

       <TextView 
        android:id="@+id/tv_detailCategory" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:paddingEnd="@dimen/activity_horizontal_margin" 
        android:paddingLeft="@dimen/activity_horizontal_margin" 
        android:paddingRight="@dimen/activity_horizontal_margin" 
        android:paddingStart="@dimen/activity_horizontal_margin" 
        android:text="category" 
        android:textColor="@android:color/white" 
        android:textSize="@dimen/abc_text_size_small_material" 
        android:textStyle="bold" /> 


       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:background="@android:color/transparent" 
        android:gravity="start|center_vertical" 
        android:orientation="horizontal" 
        android:paddingEnd="@dimen/activity_horizontal_margin" 
        android:paddingLeft="@dimen/activity_horizontal_margin" 
        android:paddingRight="@dimen/activity_horizontal_margin" 
        android:paddingStart="@dimen/activity_horizontal_margin"> 

        <TextView 
         android:id="@+id/tv_detailRatingNumber" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textColor="@android:color/white" 
         android:textSize="@dimen/abc_text_size_small_material" /> 

        <RatingBar 
         android:id="@+id/rb_detailRatingBarStars" 
         style="?android:attr/ratingBarStyleIndicator" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_gravity="center_vertical" 
         android:numStars="5" 
         android:progressDrawable="@drawable/rating_star_white" 
         android:stepSize="0.1" /> 

        <TextView 
         android:id="@+id/tv_detailRatingAmount" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textColor="@android:color/white" 
         android:textSize="@dimen/abc_text_size_small_material" /> 

        <TextView 
         android:id="@+id/tv_detailRatingBarDollars" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textColor="@android:color/white" 
         android:textSize="@dimen/abc_text_size_small_material" /> 

       </LinearLayout> 
      </LinearLayout> 

      <android.support.v7.widget.Toolbar 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="?actionBarSize" 
       android:gravity="bottom" 
       android:paddingEnd="0dp" 
       android:paddingLeft="8dp" 
       android:paddingRight="0dp" 
       android:paddingStart="8dp" 
       app:layout_collapseMode="pin" /> 
     </android.support.design.widget.CollapsingToolbarLayout> 
    </android.support.design.widget.AppBarLayout> 

    <android.support.v4.widget.NestedScrollView 
     android:id="@+id/nsv_detailScrollView" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

     <include 
      android:id="@+id/ll_detailParent" 
      layout="@layout/venue_detail_view" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 
    </android.support.v4.widget.NestedScrollView> 

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

<!-- The drawer content view --> 
<android.support.design.widget.NavigationView 
    android:id="@+id/nv_nav_drawer_main" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    app:headerLayout="@layout/drawer_list_header" 
    app:menu="@menu/drawer_items" /> 

回答