使用view.setSystemUiVisibility()的一点心得
2012-05-18 10:55
295 查看
最近的项目中使用到了view.setSystemUiVisibility()这个方法,该方法可以在3.0和4.0上进行隐藏系统导航栏的操作,但搞来搞去总是无效。
经过一幅资料搜索和研究,这个方法要想有效需要将项目的最低版本号设为11,如:<uses-sdk android:minSdkVersion="11" />
另外的设置方法可以参考这篇文章:
http://android-developers.blogspot.de/2012/01/say-goodbye-to-menu-button.html
节选:
If your app runs on a device without a dedicated Menu button, the system decides whether to add the action overflow to the navigation bar based on which API levels you declare to support in the
manifest element. The logic boils down to:
If you set either
Otherwise, the system will add the legacy overflow button when running on Android 3.0 or higher.
The only exception is that if you set
add the legacy overflow button when running your appon a handset with Android 4.0 or higher.
That exception might be a bit confusing, but it’s based on the belief that if you designed your app to support pre-Honeycomb handsets and Honeycomb tablets, it probably expects handset devices to include a Menu button (but it supports tablets that don’t
have one).
So, to ensure that the overflow action button never appears beside the system navigation, you should set the
older devices.)
最后一句是重点~既可以隐藏导航栏,又可以保持对低版本的兼容性~
经过一幅资料搜索和研究,这个方法要想有效需要将项目的最低版本号设为11,如:<uses-sdk android:minSdkVersion="11" />
另外的设置方法可以参考这篇文章:
http://android-developers.blogspot.de/2012/01/say-goodbye-to-menu-button.html
节选:
If your app runs on a device without a dedicated Menu button, the system decides whether to add the action overflow to the navigation bar based on which API levels you declare to support in the
<uses-sdk>
manifest element. The logic boils down to:
If you set either
minSdkVersionor
targetSdkVersionto 11 or higher, the systemwill not add the legacy overflow button.
Otherwise, the system will add the legacy overflow button when running on Android 3.0 or higher.
The only exception is that if you set
minSdkVersionto 10 or lower, set
targetSdkVersionto 11, 12, or 13, and you do not useActionBar, the systemwill
add the legacy overflow button when running your appon a handset with Android 4.0 or higher.
That exception might be a bit confusing, but it’s based on the belief that if you designed your app to support pre-Honeycomb handsets and Honeycomb tablets, it probably expects handset devices to include a Menu button (but it supports tablets that don’t
have one).
So, to ensure that the overflow action button never appears beside the system navigation, you should set the
targetSdkVersionto 14. (You can leave
minSdkVersionat something much lower to continue supporting
older devices.)
最后一句是重点~既可以隐藏导航栏,又可以保持对低版本的兼容性~
相关文章推荐
- 关于UITableView的一点使用心得
- 数据库触发器(Trigger)的一点使用心得
- 数据库触发器(Trigger)的一点使用心得
- DrawerLayout和NavigationView使用心得
- 使用Authentication的一点心得
- 关于C#多线程、网络编程与计时器Timer的一点使用心得
- Unity5的AssetBundle的一点使用心得
- Ios左右菜单PPRevealSideviewController使用的一些心得
- LINQ使用的一点心得
- 随机种子关于rand和srand函数使用的一点心得
- VS2003使用后的一点心得
- 使用开发工具的一点小心得
- 使用DateGrid的ItemCommand的一点心得
- 使用Spring Boot Gradle 打war包的一点心得体会
- 使用xrc的一点心得
- 关于设计模式一点使用心得
- RecycleView使用心得【2】
- 关于使用mui的一点心得
- 安卓开发学习心得-------WebView的使用
- Ios左右菜单PPRevealSideviewController使用的一些心得