Insects hd wallpaper, high resolution wallpaper, free wallpapers for desktop, free wallpaper desktop, free desktop wallpaper, desktop wallpaper free, desktop wallpaper, wallpaper computer, free desktop wallpapers, monitor wallpaper
Home » Archives for 05/12/13
Humour hd wallpaper, funny hd wallpapers
Humour hd wallpaper, funny hd wallpapers, hd wallpaper, wallpaper for backgrounds, wallpaper backgrounds, desktop wallpaper, wallpapers high definition, wallpaper and backgrounds, backgrounds for wallpapers
Horror wallpaper, horror wallpapers
Horror wallpaper, horror wallpapers, free horror wallpaper, scary wallpapers, halloween wallpaper, horror pictures, dark wallpapers, horror stories, gothic wallpaper, horror movies
Health hd wallpaper, high resolution wallpaper
Health hd wallpaper, high resolution wallpaper, hi resolution wallpaper, desktop wallpaper, high resolution images, wallpaper desktop free, free desktop wallpapers, desktop wallpaper free, computer wallpaper, hi res images
Show and hide ActionBar using Java code
With android:theme="@android:style/Theme.Holo" is using, Java code can detect if ActionBar is showing currently by calling ActionBar.isShowing() method, and show/hide it by calling ActionBar.show()/ActionBar.hide().
AndroidManifest.xml
Related:
- Display and hide ActionBar in XML
Next:
- Save state of ActionBar visibility
package com.example.androidactionbar;
import android.os.Bundle;
import android.app.ActionBar;
import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button buttonToggleActionBar = (Button)findViewById(R.id.toggleactionbar);
buttonToggleActionBar.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0) {
ActionBar myActionBar = getActionBar();
boolean myActionBarisShowing = myActionBar.isShowing();
if(myActionBarisShowing){
myActionBar.hide();
Toast.makeText(getApplicationContext(),
"Hide ActionBar",
Toast.LENGTH_LONG).show();
}else{
myActionBar.show();
Toast.makeText(getApplicationContext(),
"Show ActionBar",
Toast.LENGTH_LONG).show();
}
}});
}
}
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<Button
android:id="@+id/toggleactionbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Toggle ActionBar" />
</LinearLayout>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.androidactionbar"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo" >
<activity
android:name="com.example.androidactionbar.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Related:
- Display and hide ActionBar in XML
Next:
- Save state of ActionBar visibility
Display and hide ActionBar in XML
To use Theme.Holo (or its descendants) for Android 3.0 or higher to show ActionBar.
android:theme="@android:style/Theme.Holo"
To hide Action Bar use Theme.Holo.NoActionBar or Theme.Holo.NoActionBar.Fullscreen.
android:theme="@android:style/Theme.Holo.NoActionBar"
android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen"
Related:
- Show and hide ActionBar using Java code
android:theme="@android:style/Theme.Holo"
To hide Action Bar use Theme.Holo.NoActionBar or Theme.Holo.NoActionBar.Fullscreen.
android:theme="@android:style/Theme.Holo.NoActionBar"
android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen"
Related:
- Show and hide ActionBar using Java code