Actionbar Tutorials Part 02----Removing Action Bar

March 27, 2014
We can hide the action bar at runtime by calling hide()

Example:

ActionBar actionBar = getSupportActionBar();
actionBar.hide();

On API level 11 or higher Get the ActionBar with the getActionBar() method.

Example Program:
ScreenShot:

MainActivity.java:
package com.example.demo;

import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;

public class MainActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
      
        //hiding ActionBar
        ActionBar actionBar = getSupportActionBar();
        actionBar.hide();
    }
}

Artikel Terkait

Previous
Next Post »