欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

android屏幕全屏的实现代码

程序员文章站 2023-12-06 10:21:22
去掉标题栏:requestwindowfeature(window.feature_no_title);api上是这么说的:int   &nb...
去掉标题栏:
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());
     }