一 全部隐藏
可以试下
<uses-sdk android:minSdkVersion="15" />或者targetVersion=15
版本号可以对应你的手机的ROM的系统版本

二 部分隐藏

在VIEW对象上调用setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

Controls for system UI visibility

Since the early days of Android, the system has managed a UI component known as the status bar, which resides at the top of handset devices to deliver information such as the carrier signal, time, notifications, and so on. Android 3.0 added the system bar for tablet devices, which resides at the bottom of the screen to provide system navigation controls (Home, Back, and so forth) and also an interface for elements traditionally provided by the status bar. In Android 4.0, the system provides a new type of system UI called the navigation bar. You might consider the navigation bar a re-tuned version of the system bar designed for handsets—it provides navigation controls for devices that don’t have hardware counterparts for navigating the system, but it leaves out the system bar's notification UI and setting controls. As such, a device that provides the navigation bar also has the status bar at the top.

To this day, you can hide the status bar on handsets using the FLAG_FULLSCREEN flag. In Android 4.0, the APIs that control the system bar’s visibility have been updated to better reflect the behavior of both the system bar and navigation bar:

The SYSTEM_UI_FLAG_LOW_PROFILE flag replaces the STATUS_BAR_HIDDEN flag. When set, this flag 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.
The SYSTEM_UI_FLAG_VISIBLE flag replaces the STATUS_BAR_VISIBLE flag to request the system bar or navigation bar be visible.
The SYSTEM_UI_FLAG_HIDE_NAVIGATION is a new flag 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. As such, this mode is useful primarily for video playback or other cases in which the whole screen is needed but user input is not required.

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.

To synchronize other events in your activity with visibility changes to the system UI (for example, hide the action bar or other UI controls when the system UI hides), you should register a View.OnSystemUiVisibilityChangeListener to be notified when the visibility of the system bar or navigation bar changes.

See the OverscanActivity class for a demonstration of different system UI options.

import android.app.Activity;  import android.os.Bundle;  import android.view.View;  import android.view.View.OnClickListener;    public class HideTestActivity extends Activity implements OnClickListener{      View main ;      /** Called when the activity is first created. */      @Override      public void onCreate(Bundle savedInstanceState) {          super.onCreate(savedInstanceState);          main = getLayoutInflater().from(this).inflate(R.layout.main, null);          main.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);          main.setOnClickListener(this);          setContentView(main);      }        @Override      public void onClick(View v) {          int i = main.getSystemUiVisibility();          if (i == View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) {              main.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);          } else if (i == View.SYSTEM_UI_FLAG_VISIBLE){              main.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);          } else if (i == View.SYSTEM_UI_FLAG_LOW_PROFILE) {              main.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);          }      }  } 

更多相关文章

  1. 【Android(安卓)Dev Guide - 02】 - Application Fundamentals
  2. android webview不支持input type=file 标签解决办法
  3. Android(安卓)版本号比较
  4. Android(安卓)四大组件之 Activity(1)--生命周期
  5. android关闭或开启移动网络数据(关闭后,设备不可以上网,但可以打电
  6. Android(安卓)Studio更新升级方法
  7. Android(安卓)Graphics - 3 BufferQueue 和 Gralloc
  8. 【android】Intent 和 Intent Filter
  9. Android(安卓)EditText默认不弹出输入法

随机推荐

  1. Android 获取屏幕尺寸
  2. Android Fragment 和 Activity相互传值
  3. Android(安卓)SDK 中文 (56) —— ViewFlip
  4. Android 关闭当前程序
  5. Android如何判断手机里是否安装了某个应
  6. Android(安卓)自定义View(自定义控件)
  7. ViewPager如下效果你研究过吗?
  8. Android防止用户快速点击
  9. android 获取 service 信息
  10. Android标题栏最右边添加按钮