安卓隐藏标题栏状态栏 ,实现全屏效果
16lz
2021-01-23
隐藏标题栏需要使用预定义样式:android:theme=”@android :style/Theme.NoTitleBar”.
隐藏状态栏:android:theme=”@android :style/Theme.NoTitleBar.Fullscreen”.
[代码][XML]代码
01 | <? xml version = "1.0" encoding = "utf-8" ?> |
02 | < manifest xmlns:android = "http://schemas.android.com/apk/res/android" |
03 |
package = "de.vogella.android.temperature" |
04 |
android:versionCode = "1" |
05 |
android:versionName = "1.0" > |
06 |
< application android:icon = "@drawable/icon" android:label = "@string/app_name" > |
07 |
< activity android:name = ".Convert" |
08 |
android:label = "@string/app_name" |
09 |
android:theme = "@android :style/Theme.NoTitleBar.Fullscreen" > |
10 |
< intent-filter > |
11 |
< action android:name = "android.intent.action.MAIN" /> |
12 |
< category android:name = "android.intent.category.LAUNCHER" /> |
13 |
</ intent-filter > |
14 |
</ activity > |
15 |
|
16 |
</ application > |
17 |
< uses-sdk android:minSdkVersion = "9" /> |
18 |
|
19 | </ manifest > |
[代码][Java]代码
view source print ?01 | @Override |
02 | public void onCreate(Bundle savedInstanceState) { |
03 |
super .onCreate(savedInstanceState); |
04 |
// hide titlebar of application |
05 |
// must be before setting the layout |
06 |
requestWindowFeature(Window.FEATURE_NO_TITLE); |
07 |
// hide statusbar of Android |
08 |
// could also be done later |
09 |
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, |
10 |
WindowManager.LayoutParams.FLAG_FULLSCREEN); |
11 |
setContentView(R.layout.main); |
12 |
text = (EditText) findViewById(R.id.EditText01); |
13 |
|
14 | } |
更多相关文章
- Android安卓51个开源代码
- 修改ScrollView滚动条样式
- Android 代码改变图片颜色android:tint="@color/main_color" and
- android的ProgressBar设置为水平样式
- Android系统自带样式(android:theme)
- Kotlin 写 Android 单元测试(四),Robolectric 在 JVM 上测试安卓相