Reputation: 478
I am wanting to get rid of the Activity Title Bar as it is annoying to have. However, I do not want to have a fullscreen activity.I have tried just adding @android:style/Theme.NoTitleBar
to activity and android:theme="@android:style/Theme.NoTitleBar.Fullscreen
to the manifest file, but I keep getting the error: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity
. Nothing seems to help.
Upvotes: 0
Views: 1587
Reputation: 1190
You can extend Activity
instead of AppCompatActivity
and use the following code:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// remove title bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
// remove notification bar
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_splash);
}
Upvotes: 1
Reputation: 1161
Simplest way to go:
getActionBar().hide();
put it in your onCreate method and you'll never see the Action Bar.
Upvotes: 0
Reputation: 2216
If it asked you use Appcompat theme - use appcompat theme
Theme.AppCompat.Light.NoActionBar
Upvotes: 1
Reputation:
Do this in onCreate
//Remove title bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
In your style.xml
<style name="Theme.AppCompat.Light.NoActionBar" parent="@style/Theme.AppCompat.Light">
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
</style>
Hope it helps
Upvotes: 0