zoukankan      html  css  js  c++  java
  • android动态全屏切换

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

  • 相关阅读:
    Javascript代码收集
    JS表自动取值赋值
    数据分析04 /基于pandas的DateFrame进行股票分析、双均线策略制定
    数据分析03 /基于pandas的数据清洗、级联、合并
    数据分析02 /pandas基础
    数据分析01 /numpy模块
    爬虫07 /scrapy图片爬取、中间件、selenium在scrapy中的应用、CrawlSpider、分布式、增量式
    爬虫06 /scrapy框架
    爬虫05 /js加密/js逆向、常用抓包工具、移动端数据爬取
    爬虫04 /asyncio、selenium规避检测、动作链、无头浏览器
  • 原文地址:https://www.cnblogs.com/jiezzy/p/2673219.html
Copyright © 2011-2022 走看看