androidsplash-screentitlebarcustom-titlebar

Title bar keeps appearing, even with requestWindowFeature or android:theme


My question is exactly the sabe as Custom titlebar - system titlebar being shown for a brief moment?

But I couldn't achieve the same results as @Jerry wrote on best answer. "When I switched to using a theme to tell the framework I didn't want a title, the problem went away and I now see my own title directly on first load"

My code:

Manifest:

<?xml version="1.0" encoding="UTF-8"?>
<manifest android:versionCode="3" android:versionName="1.0.2"
package="androidhive.dashboard"     xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="8"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application android:icon="@drawable/icone" android:label="@string/app_name">
    <activity 
        android:name="com.androidhive.dashboard.SplashScreen"
        android:theme="@android:style/Theme.NoTitleBar"
        android:label="@string/app_name"
        android:windowSoftInputMode="stateHidden|adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>

layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/SplashTheme"
 >

<ImageView
android:id="@+id/splashscreen_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
android:contentDescription="Splash"
android:scaleType="centerCrop"
android:src="@drawable/splash"
style="@style/SplashTheme" />

</LinearLayout>

Style:

<style name="SplashTheme" parent="@android:Theme.Black">
<item name="android:windowNoTitle">true</item>
<item name="android:background">@drawable/splash</item>
</style>

SplashScreen.java

public class SplashScreen extends Activity implements Runnable{


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setTheme(R.style.SplashTheme);
    setContentView(R.layout.splashscreen_layout);




    Handler h = new Handler();
    h.postDelayed(this, 15000);
}

@Override
public void run() {
    startActivity(new Intent(this, AndroidDashboardDesignActivity.class));
    finish();
}
}

Thank you for helping!


Solution

  • Put:

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

    Under your application tab, not your activity one