lundi 4 juillet 2016

Find title textview in toolbar after replacing the ActionBar

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/...) ?

Aucun commentaire:

Enregistrer un commentaire