Android實(shí)現(xiàn)全屏顯示的方法

Android實(shí)現(xiàn)全屏顯示的方法

我們都知道在Android中某些功能的實(shí)現(xiàn)往往有兩種方法:一種是在xml文件中設(shè)置相應(yīng)屬性,另一種是用代碼實(shí)現(xiàn)。同樣Android實(shí)現(xiàn)全屏顯示也可以通過這兩種方法實(shí)現(xiàn):

創(chuàng)新互聯(lián)網(wǎng)站建設(shè)公司一直秉承“誠信做人,踏實(shí)做事”的原則,不欺瞞客戶,是我們最起碼的底線! 以服務(wù)為基礎(chǔ),以質(zhì)量求生存,以技術(shù)求發(fā)展,成交一個(gè)客戶多一個(gè)朋友!專注中小微企業(yè)官網(wǎng)定制,網(wǎng)站設(shè)計(jì)制作、做網(wǎng)站,塑造企業(yè)網(wǎng)絡(luò)形象打造互聯(lián)網(wǎng)企業(yè)效應(yīng)。

1、在AndroidManifest.xml的配置文件里面的<activity>標(biāo)簽添加屬性:

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

2、在Activity的onCreate()方法中的super()和setContentView()兩個(gè)方法之間加入下面兩條語句:

this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉標(biāo)題欄

this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//去掉信息欄

示例

方法一:

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

    package="test.ts.wader.p_w_picpath"

    android:versionCode="1"

    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="7" />

    <application

        android:icon="@drawable/ic_launcher"

        android:label="@string/app_name" >

        <activity

           android:label="@string/app_name"

           android:name=".ImageListActivity"

android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >

            <intent-filter >

                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />

            </intent-filter>

        </activity>

    </application>

</manifest>

 

方法二:

publicclassImageListActivity extendsActivity implementsOnItemClickListener {

    @Override

    publicvoidonCreate(Bundle savedInstanceState) {

       super.onCreate(savedInstanceState);

       requestWindowFeature(Window.FEATURE_NO_TITLE); //設(shè)置無標(biāo)題

       getWindow().setFlags(WindowManager.LayoutParams.FILL_PARENT, WindowManager.LayoutParams.FILL_PARENT);  //設(shè)置全屏  

       setContentView(R.layout.p_w_picpath_list_layout);

    }

}

分享題目:Android實(shí)現(xiàn)全屏顯示的方法
文章URL:http://muchs.cn/article32/ijdcsc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計(jì)、網(wǎng)站改版搜索引擎優(yōu)化、移動(dòng)網(wǎng)站建設(shè)、外貿(mào)建站、網(wǎng)站設(shè)計(jì)公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站網(wǎng)頁設(shè)計(jì)