get Title TextView from Toolbar - Android User Interface

Android examples for User Interface:TextView

Description

get Title TextView from Toolbar

Demo Code


//package com.java2s;

import android.widget.TextView;
import android.widget.Toolbar;

public class Main {
    private static TextView getTitleTextView(Toolbar toolbar) {
        TextView textView = null;//from   www  .  j av a  2s.c om
        for (int i = 0; i < toolbar.getChildCount(); i++) {
            if (toolbar.getChildAt(i).getClass() == TextView.class) {
                textView = (TextView) toolbar.getChildAt(i);
            }
        }
        return textView;
    }
}

Related Tutorials