How to Hide Actionbar in Android
In this Tutorial we will explain how to hide ActionBar Programmatically or via Manifest.xml.
Step 1. first , Manifest.xml class...
mostally dosen't required actionbar in Splash screen.
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
...................................................................................................................................................................
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.androidbeginnerpoint"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".SplashScreen"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.webnetware.singingbowl.MainActivity"
android:screenOrientation="portrait" >
</activity>
</application>
</manifest>
Step 2. second ,SplashActivity.java programmtic....
ActionBar actionBar = getActionBar(); /*or getSupportActionBar();*/
// Hide actionbar
actionBar.hide();
..................................................................................................................................................................
package com.example.androidbeginnerpoint;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
public class SplashScreen extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar actionBar = getActionBar(); /*or getSupportActionBar();*/
// Hide actionbar
actionBar.hide();
// show actionbar
// actionBar.Show();
setContentView(R.layout.splash_screen);
new Handler().postDelayed(new Runnable() {
public void run() {
Intent intent = new Intent(SplashScreen.this,MainActivity.class);
startActivity(intent);
finish();
overridePendingTransition(R.anim.slide_in_right,R.anim.stay);
}
}, 3000);
}
}
0 comments