Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> 關於Android編程 >> android屏幕全屏的實現代碼

android屏幕全屏的實現代碼

編輯:關於Android編程

去掉標題欄:
requestWindowFeature(Window.FEATURE_NO_TITLE);
API上是這麼說的:
int     FEATURE_NO_TITLE     Flag for the "no title" feature, turning off the title at the top of the screen.
屏幕全屏:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
API上是這麼說的:
int     FLAG_FULLSCREEN     Window flag: Hide all screen decorations (e.g.
屏幕沒有邊界限制(允許窗口擴展到屏幕外):
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
API上是這麼說的:
int     FLAG_LAYOUT_NO_LIMITS     Window flag: allow window to extend outside of the screen.
用法:
復制代碼 代碼如下:
 @Override
     protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
         super.onCreate(savedInstanceState);
         requestWindowFeature(Window.FEATURE_NO_TITLE);
         getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
         getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
         setContentView(R.layout.newslists);
         newsListLayout = findViewById(R.id.newslistlayout);
         newsListLayout.setBackgroundColor(Color.MAGENTA);

         newsNameList = (ListView) findViewById(R.id.newsnamelist);
         model = new Model(0, 6);
         nameListAdapter = new NewsNameListAdapter(this, model);
         newsNameList.setAdapter(nameListAdapter);

         showPage = (TextView) findViewById(R.id.newslistshowpage);
         updatePage(model.getIndex());
     }
  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved