package com.screen;   2.   3. import android.app.Activity;   4. import android.os.Bundle;   5. import android.view.View;   6. import android.view.WindowManager;   7. import android.view.View.OnClickListener;   8. import android.widget.Button;   9.   10. public class MainActivity extends Activity {   11.       12.    private boolean isFulllScreen = false;   13.    private Button button;   14.       15.    @Override   16.    public void onCreate(Bundle savedInstanceState) {   17.        super.onCreate(savedInstanceState);   18.        setContentView(R.layout.main);   19.        button = (Button)findViewById(R.id.button);   20.        button.setOnClickListener(new OnClickListener() {   21.               22.            @Override   23.            public void onClick(View v) {   24.                isFulllScreen = !isFulllScreen;   25.                if (isFulllScreen) {   26.                    button.setText(getResources().getText(R.string.exit_full_screen));   27.                    WindowManager.LayoutParams params = getWindow().getAttributes();   28.                    params.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;   29.                    getWindow().setAttributes(params);   30.                    getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);   31.                } else {   32.                    button.setText(getResources().getText(R.string.full_screen));   33.                    WindowManager.LayoutParams params = getWindow().getAttributes();   34.                    params.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);   35.                    getWindow().setAttributes(params);   36.                    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);   37.                }   38.            }   39.        });   40.           41.    }   42.}  

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Android(安卓)获得手机屏幕大小
  2. Android_ScrollView
  3. android 跳动频谱 播放器(类似千千静听)
  4. android studio使用android annotations
  5. Android应用程序编译问题
  6. Timer的schedule和scheduleAtFixedRate的
  7. SeekBar 粗略小节
  8. 第一个android程序以及遇到问题解决办法
  9. Android-->RatingBar自定义大小,自定义样
  10. Android(安卓)Windows开发环境搭建