Sms Gratis Indosat

Phone Numbers
0 -
Example : 83832867987 Without 0

Type your Messages

Question: + =

Hide and auto-show the navigation bar, for Android 4.0 or higher


In last exercise to display a big picture, I want to hide the the navigation bar (Home, Back, ...) to leave for space for the big picture.

In Android 4.0, the APIs updated with new flags of SYSTEM_UI_FLAG_HIDE_NAVIGATION, that requests the navigation bar hide completely. Be aware that this works only for the navigation bar used by some handsets (it does not hide the system bar on tablets). The navigation bar returns to view as soon as the system receives user input.


You can also use SYSTEM_UI_FLAG_LOW_PROFILE flag, to enables “low profile" mode for the system bar or navigation bar. Navigation buttons dim and other elements in the system bar also hide. Enabling this is useful for creating more immersive games without distraction for the system navigation buttons, and SYSTEM_UI_FLAG_VISIBLE flag to request the system bar or navigation bar be visible.


You can set each of these flags for the system bar and navigation bar by calling setSystemUiVisibility() on any view in your activity. The window manager combines (OR-together) all flags from all views in your window and apply them to the system UI as long as your window has input focus. When your window loses input focus (the user navigates away from your app, or a dialog appears), your flags cease to have effect. Similarly, if you remove those views from the view hierarchy their flags no longer apply.


Example:

The navigation bar hide when the app start
The navigation bar hide when the app start

The navigation bar return after user touched on the screen
The navigation bar return after user touched on the screen


package com.exercise.AndroidBigPicture;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

public class AndroidBigPictureActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

ImageView myImageView = (ImageView)findViewById(R.id.myimageview);
myImageView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
}
}


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />

<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/myimageview"
android:src="@drawable/bigpicture"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:scaleType="center"/>
</ScrollView>
</HorizontalScrollView>
</LinearLayout>

Display scrollable ImageView bigger than screen

To display image bigger than the device screen, in true size, with scroll bar. We can embed it in a ImageView within nested ScrollView and HorizontalScrollView.

Display scrollable ImageView bigger than screen


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />

<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:src="@drawable/bigpicture"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:scaleType="center"/>
</ScrollView>
</HorizontalScrollView>
</LinearLayout>


Koenigsegg Agera R

V8 / 5.032 cc / 1.140 PS / 885 ft/lb (1.200 Nm) @ 4.100 / twin turbo / 0 - 62 mph (100 km/h): 2,9 s / 0 - 124 mph (200 km/h): 7,5 s / Vmax: 245 mph (390 km/h)

(click images for a larger view)









 
Copyright © 2015. About - Web Version - Mobile Version Sitemap - Contact - Privacy