Reputation: 722
I already remove the title in onCreate() method.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final ActionBar actionBar = getActionBar();
actionBar.setHomeButtonEnabled(false);
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayUseLogoEnabled(false);
actionBar.setDisplayShowTitleEnabled(false);
}
The title is not displayed. But still appears when launching the app.
And I can use
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
or put
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
into manifest file because I'm using actionBar. If I did that, the app crashes.
So, my question is, is there any way to remove the title when the app is launching because I am gonna put a splashscreen here. Thanks.
PLEASE NOTICE:
Thanks for your answers, but I clearly said that I already used actionBar.setDisplayShowTitleEnabled(false);
to hide the title bar of the activity. (as shown in the first picture)
BUT the title bar still appears in the launching screen (as shown in the second picture.)
and
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
and
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
would lead to crash launch. This happens after I used actionbar.
Upvotes: 6
Views: 8545
Reputation: 21
Hope below lines will help you
getWindow().clearFlags(
WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
Upvotes: 0
Reputation: 2585
Put below three line in onCreate Method before setContentview in your activity which want to display full screen
requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
Upvotes: 0
Reputation: 1
in res/values/styles.xml
find ...
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
replacing for.
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<item name="windowActionBar">false</item>
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
Save and compile...
Upvotes: 0
Reputation: 61
I had the same problem.
Personally, I solved it by replacing my Activity inheritance from ActionBarActivity to Activity.
Hope this will help someone...
Upvotes: 6
Reputation: 8588
Use this:
ActionBar bar = getActionBar();
bar.hide();
or
ActionBar bar = getActionBar();
bar.setDisplayShowHomeEnabled(false);
bar.setDisplayShowTitleEnabled(false);
Upvotes: 0
Reputation:
Set your splashscreen
as your main activity and set the theme to
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
create and intent to move your splash screen to your actual main activity
Upvotes: 0
Reputation: 3134
Nick Butcher and Katherine Kuan wrote a nice Google Plus post about a smoother app launch experience:
https://plus.google.com/+AndroidDevelopers/posts/VVpjo7KDx4H
However, if you want to be compatible with Android versions below API 14 (for example using AppCompat), the only way I could achieve this is by using a separate launch activity using a theme with no actionbar.
Upvotes: 0
Reputation: 4661
May be i am repeating the same which all are saying but i just need to confirm it.In manifest file have add the theme like the below which i added as sample or anyother way.
<application ....
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:largeHeap="true"> ..
</application>
Just remove all other code related to hide title bar only andonly add this one in the manifest file it works for me.I hope it will work to you too.
Upvotes: 0
Reputation: 1917
In your AndroidManifest.xml in application tag set your theme to full screen like in below code.
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
Upvotes: -1
Reputation: 2104
You can simply add full screen theme to that activity in your manifest file:
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
Upvotes: -1
Reputation: 6788
It might be crashing because you are using this.requestWindowFeature(Window.FEATURE_NO_TITLE);
after setContentView()
;
Use this.requestWindowFeature(Window.FEATURE_NO_TITLE);
in onCreate()
of your Activity
, before setContentView();
statement.
Upvotes: 0
Reputation: 1299
Do this in your onCreate() method.
//Remove title bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
//Remove notification bar
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
this refers to the Activity.
===========
EDIT:
if you are using ActionBarSherLock
final ActionBar bar = getSupportActionBar();
bar.setDisplayShowTitleEnabled(false);
Upvotes: 0