Android中隐藏状态栏和标题栏的方法
16lz
2021-12-04
Hide StatusBar/Title on QVGA - Getting Screen Resolution
What you learn: You will learn how to get the screen-resolution and hide the statusbar on QVGA-reoslutions (or whatever you want).
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
final Window win = getWindow();
final int screenHeight = win.getWindowManager().getDefaultDisplay().getHeight();
final int screenWidth = win.getWindowManager().getDefaultDisplay().getWidth();
if((screenHeight == 320 && screenWidth == 240) || (screenHeight == 240 && screenWidth == 320)){
// No Statusbar
win.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
// No Titlebar
requestWindowFeature(Window.FEATURE_NO_TITLE);
requestWindowFeature(Window.FEATURE_PROGRESS);
}
setContentView(R.layout.mylayout);
//... Your Code here ...
}
原帖:http://www.anddev.org/hide_statusbar-title_on_qvga_-_getting_screen_resolution-t2689.html
What you learn: You will learn how to get the screen-resolution and hide the statusbar on QVGA-reoslutions (or whatever you want).
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
final Window win = getWindow();
final int screenHeight = win.getWindowManager().getDefaultDisplay().getHeight();
final int screenWidth = win.getWindowManager().getDefaultDisplay().getWidth();
if((screenHeight == 320 && screenWidth == 240) || (screenHeight == 240 && screenWidth == 320)){
// No Statusbar
win.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
// No Titlebar
requestWindowFeature(Window.FEATURE_NO_TITLE);
requestWindowFeature(Window.FEATURE_PROGRESS);
}
setContentView(R.layout.mylayout);
//... Your Code here ...
}
原帖:http://www.anddev.org/hide_statusbar-title_on_qvga_-_getting_screen_resolution-t2689.html
更多相关文章
- 修改 ActivityManagerService.java 去掉 android 系统报错和程序
- Android(安卓)Animation学习笔记【原帖没有Demo,自己写了一个,链接
- 修改 ActivityManagerService.java 去掉 android 系统报错和程序
- [Android]挂断、接听电话
- 一个不那么完美的手势平滑拖动类FlingGallery
- M8或在明年用上Android(安卓)带Wifi与WAPI版已送检
- 【转】Android实现人人网点击“+”弹出效果
- android 汉化和反编译
- android java json与实体互相转换工具