Android 實(shí)現(xiàn)全屏和無標(biāo)題欄的顯示
在Android實(shí)現(xiàn)沒有標(biāo)題欄的方法有兩種:
在代碼中添加
requestWindowFeature(Window.FEATURE_NO_TITLE);
在清單文件AndroidManifest.xml中添加
android:theme="@android:style/Theme.NoTitleBar"
具體的代碼如下:
第一種:
MainActivity.java
package com.lingdududu.test;
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
public class MainActivity extends Activity {
/** Called when the activity is first created. */
private boolean catchHomeKey = false;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
}
}
第二種:
AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.lingdududu.test" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="10" /> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".MainActivity" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
效果圖:

如果想讓窗口全屏顯示:
將下面兩段代碼分別替換上面的兩段設(shè)置無標(biāo)題的代碼就可以了
getWindow().setFlags(WindowManager.LayoutParams. FLAG_FULLSCREEN , WindowManager.LayoutParams. FLAG_FULLSCREEN); android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
效果圖:

以上就是對Android 全屏效果的代碼實(shí)例,和效果顯示,希望能幫助到大家。
相關(guān)文章
Android自定義控件ViewGroup實(shí)現(xiàn)標(biāo)簽云(四)
這篇文章主要為大家詳細(xì)介紹了Android自定義控件ViewGroup實(shí)現(xiàn)標(biāo)簽云的相關(guān)資料,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-08-08
Flutter使用?input?chip?標(biāo)簽組件示例詳解
這篇文章主要為大家介紹了Flutter使用?input?chip?標(biāo)簽組件示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-10-10
Android通訊錄開發(fā)之刪除功能的實(shí)現(xiàn)方法
這篇文章主要介紹了Android通訊錄開發(fā)之刪除功能的實(shí)現(xiàn)方法,有需要的朋友可以參考一下2014-01-01
Android使用MediaPlayer和TextureView實(shí)現(xiàn)視頻無縫切換
這篇文章主要為大家詳細(xì)介紹了Android使用MediaPlayer和TextureView實(shí)現(xiàn)視頻無縫切換,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-10-10
Android實(shí)現(xiàn)帶頁面切換的鎖屏功能
這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)帶頁面切換的鎖屏功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-06-06
android導(dǎo)入第三方j(luò)ar包報(bào)錯 如何正確導(dǎo)入jar包
怎樣在android平臺上使用第三方j(luò)ar包,為什么我在引入了,編譯時(shí)沒有錯誤,運(yùn)行時(shí)就有錯誤,報(bào)無法實(shí)例化錯誤,請問這是什么原因,本文給于解決方法,需要了解的朋友可以參考下2012-12-12
Android控件ViewPager實(shí)現(xiàn)帶有動畫的引導(dǎo)頁
這篇文章主要為大家詳細(xì)介紹了Android控件ViewPager實(shí)現(xiàn)帶有動畫的引導(dǎo)頁,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-05-05

