1

The material scrolling activity can display title in the Coordinator-layout.

enter image description here

We can get it by replacing actionbar with a toolbar by:

 Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
 setSupportActionBar(toolbar);

And the xml:

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

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin"
            app:popupTheme="@style/AppTheme.PopupOverlay"/>
    </android.support.design.widget.CollapsingToolbarLayout>

If I add textView in the toolbar, i find it doesnot have zoom effect like the default one.

My question is: How can I find this title textview so that I can modify it (change font/color/...) ?

T D Nguyen
  • 7,054
  • 4
  • 51
  • 71
  • 2
    Why don't you just put your own `TextView` in the `Toolbar` for the title? `Toolbar` is a `ViewGroup`. – Mike M. Jun 15 '16 at 11:46
  • I find it does not have the zoom (paralax) effect like the default one. – T D Nguyen Jun 15 '16 at 11:59
  • 1
    Ah, I see. Well, I've not done enough with `CoordinatorLayout` to know how to setup that behavior for your own, but you could get a reference to the title `TextView` in a manner similar to what's described in [my answer here](http://stackoverflow.com/a/28280347). If you use the reflective method, the title `TextView`'s field name is `"mTitleTextView"`. – Mike M. Jun 15 '16 at 12:07

0 Answers0