Reputation: 101
I would like to ask is there any means to hide the title bar from showing it on the splash screen page? I tried changing the theme through the design page ,
tried
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen
and
requestWindowFeature(Window.FEATURE_NO_TITLE);
and
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
but the title bar is still there , is there any way to hide it ?
Regards.
Upvotes: 0
Views: 1301
Reputation: 79646
For AppCompat
, following solution worked for me:
Add new theme style with no action bar in your styles.xml
and set parent="Theme.AppCompat.NoActionBar"
.
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimary</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowBackground">@color/colorPrimary</item>
</style>
Now implement the same theme style to your splash screen activity in androidManifest.xml
<activity
android:name=".ActivityName"
android:theme="@style/SplashTheme"> // apply splash them here
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Here is result:
Upvotes: 0
Reputation: 668
Add two line above setContentView(R.layout.test_activity);
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
getActionBar().hide();
setContentView(R.layout.test_activity);
Upvotes: 1
Reputation: 77
Really easy! Just add this code before your "setContentView" in your Activity class. requestWindowFeature(Window.FEATURE_NO_TITLE);
Regards, Gabriel
Upvotes: 0
Reputation: 6140
Set android:theme="@android:style/Theme.NoTitleBar.Fullscreen" in your AndroidManifest.xml file like bellow.
<activity
android:name=".activity.SplashActivity"
android:screenOrientation="portrait"
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>
Upvotes: 0