Android examples for User Interface:Toolbar
Draws a toolbar in the appropriate place programmatically.
import android.support.v7.app.AppCompatActivity; import android.widget.Toolbar; public class Main { /**/*from w w w .j av a 2 s . c om*/ * Draws a toolbar in the appropriate place programmatically. * * @param activity * the activity you want to display the toolbar on. * @param toolbar * your toolbar. * @param title * the toolbar title. */ public static void drawToolbar(AppCompatActivity activity, Toolbar toolbar, String title) { toolbar.setTitle(title); activity.setSupportActionBar(toolbar); } }