Android - 全屏只在启动画面而不是在应用程序中

时间:2013-12-08 22:26:00

标签: android titlebar

我想在全屏显示我的启动画面。我用这个:

<activity android:name="app" android:label="@string/app_name"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
</activity>

但是当我的启动画面完成后,我的应用程序会显示在我的状态栏之后。

这是我的manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"   android:windowSoftInputMode="adjustPan"
  package="com.maps" android:versionName="1.0" android:versionCode="1" android:hardwareAccelerated="true">
<supports-screens
    android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:xlargeScreens="true"
    android:resizeable="true"
    android:anyDensity="true"
    />

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />   
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.INTERNET"/>


<application android:icon="@drawable/icon" android:label="@string/app_name"
    android:hardwareAccelerated="true"        
    android:debuggable="true">
    <activity android:name="app" android:label="@string/app_name"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

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

这是我的app.java课程:

public class app extends DroidGap
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        // Set by <content src="index.html" /> in config.xml
        //super.loadUrl(Config.getStartUrl());
        super.setIntegerProperty("splashscreen", R.drawable.splash);
        super.loadUrl("file:///android_asset/www/index.html", 5000);
    }
}

如果我删除“全屏”,应用程序显示正常,但启动画面不全屏。

1 个答案:

答案 0 :(得分:9)

在你的启动活动或任何想要全屏的活动中添加它,就在你的setContentView()之前:

requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);