2016-06-13 8 views
4

私は最初に拡張/折りたたみツールバーと接触しています。 this great tutorialの後にいくつかの結果があります。 (それが可能の場合)私はこのEditTextを含む拡張ツールバー

に似た何かを持っているように、 EditText秒のカップルのための

enter image description here

(下記タイトル「Anthoriro」を参照)

今、私は、静的なタイトルを交換したいと思いますこの場合

enter image description here

、ツールバーが折りたたまれているときに表示されるテキストは、タイトルプロジェクトの優先順位になり

答えて

1

この

<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/htab_maincontent" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:fitsSystemWindows="true"> 

      <android.support.design.widget.AppBarLayout 
       android:id="@+id/htab_appbar" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:fitsSystemWindows="true" 
       android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

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

        <RelativeLayout 
         android:id="@+id/htab_header" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:fitsSystemWindows="true" 
         app:layout_collapseMode="parallax" 
         > 

         <EditText 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:inputType="text" 
          android:ems="10" 
          android:id="@+id/editText2" 
          android:hint="Title" 
          android:text="Project" 
          android:layout_centerVertical="true" 
          android:layout_centerHorizontal="true"/> 

         <EditText 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:text="Name" 
          android:ems="10" 
          android:id="@+id/editText3" 
          android:layout_below="@+id/editText2" 
          android:layout_alignLeft="@+id/editText2" 
          android:layout_alignStart="@+id/editText2" 
          android:layout_marginTop="28dp" 
          android:inputType="text"/> 
        </RelativeLayout> 

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


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


     <--Swap this with your scrollable view --> 

      <android.support.v4.view.ViewPager 
       android:id="@+id/mViewPager" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       app:layout_behavior="@string/appbar_scrolling_view_behavior"/> 
     </android.support.design.widget.CoordinatorLayout> 

のようなレイアウトを作成し、活動/フラグメントのそれは私の最後の試みは、このアプローチに似ているが、私は/が欲しかった期待どおりに動作しません

//Dont forget to find your CoolapsingLayout first :) 

//set The custom text 
mCollapisngToolbar.setTitle("TEXTTTs"); 

//Set the color of collapsed toolbar text 
mCollapisngToolbar.setCollapsedTitleTextColor(ContextCompat.getColor(this, R.color.White)); 

//This will set Expanded text to transparent so it wount overlap the content of the toolbar   
mCollapisngToolbar.setExpandedTitleColor(ContextCompat.getColor(this, R.color.Transparent)); 
+0

を設定します。私は似たような見た目のアプリケーションを見たことがないので、私が欲しいものに対して良い解決策はないと思います。 – kazbeel

+0

あなたはtextinputにtext changedリスナを付けて、タイトルを設定してもいいが、本当に悪いと思う。 –

関連する問題