2016-04-07 32 views
0

değil araç çubuğunda başlığı gösterebilir Ben her bir collapsing Toolbar her Thing kullandığınızda ok ama ben, daraltma araç çubuğu başlığı ile küçük bir sorun var, sadece çökmesini araç çubuğu kapalı olduğunda başlık göstermek istiyorum Kapı açık değilken: bu işi olabilir gibiSadece açık araç çubuğu

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/main_content" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true"> 

    <android.support.design.widget.AppBarLayout 
     android:id="@+id/MyAppbar" 
     android:layout_width="match_parent" 
     android:layout_height="256dp" 
     android:fitsSystemWindows="true"> 

     <android.support.design.widget.CollapsingToolbarLayout 
      android:id="@+id/collapse_toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@android:color/transparent" 
      android:fitsSystemWindows="true" 
      app:contentScrim="?attr/colorPrimary" 
      app:layout_scrollFlags="scroll|exitUntilCollapsed"> 

      <ImageView 
       android:id="@+id/bgheader" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:scaleType="centerCrop" 
       android:fitsSystemWindows="true" 
       android:background="@drawable/aks" 
       app:layout_collapseMode="parallax" /> 

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

     </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:layout_gravity="fill_vertical" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="سلام"/> 

    </android.support.v4.widget.NestedScrollView> 

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

cevabıma bakın ... –

cevap

1

programlı olarak ayarlayın:

enter image description here

Bu i çöken araç çubuğu eklemek benim xml olduğunu.

collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapse_toolbar); 
collapsingToolbarLayout.setTitle("WhiteBoard"); 
collapsingToolbarLayout.setExpandedTitleColor(ContextCompat.getColor(context,R.color.transperent)); 
collapsingToolbarLayout.setCollapsedTitleTextColor(Color.rgb(0, 0, 0)); 
+1

@majid cevabımı arayın. –

+0

Sulutuion'unuz için teşekkürler, ancak iş ve başlık hala gösterilmiyor. – majid

+1

@majid Güncelleme yanıtımı gör. –