Created
January 31, 2017 13:16
-
-
Save alfianyusufabdullah/ce09703812ec0648c44b75d9035d5cd6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.jonesrandom.tutorialmembuattoolbar; | |
| import android.support.v7.app.AppCompatActivity; | |
| import android.os.Bundle; | |
| import android.support.v7.widget.Toolbar; | |
| public class MainActivity extends AppCompatActivity { | |
| Toolbar myToolbar; | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.activity_main); | |
| myToolbar = (Toolbar) findViewById(R.id.my_toolbar); | |
| /// Mengatur Toolbar ke dalam Support Action Bar | |
| setSupportActionBar(myToolbar); | |
| /// Merubah Title Toolbar | |
| getSupportActionBar().setTitle("Ini Tittle Toolbar"); | |
| /// Menambah subtitle pada Toolbar | |
| getSupportActionBar().setSubtitle("Ini Subtittle Toolbar"); | |
| /// Menambah Icon Pada Toolbar | |
| getSupportActionBar().setDisplayUseLogoEnabled(true); | |
| getSupportActionBar().setLogo(R.mipmap.ic_launcher); | |
| /// Mengaktifkan Home Button Toolbar | |
| getSupportActionBar().setDisplayHomeAsUpEnabled(true); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment