Reputation: 51
I have downloaded android theme and trying to adding new activity further.
using Android Studio 3.0.1 / API 27.
I am trying to add new page by duplicating existing activity which did not have Action bar (screen shot here) No Actionbar
I could see the new page has action bar (screenshot here) with Actionbar
in my styles.xml file has added Noaction bar settings.
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="windowNoTitle">true</item>
</style>
Even try to create empty activity, it shows the action bar. I couldn't be found any other run time code for the settings. I want load the activity using fragment while the button click as per my customize design.
since I couldn't create new activity without Action bar, I stuck in this stage.
it is downloaded theme and comes with no action bar settings. couldn't add any further activity without that?
I have seen all existing method which are already questioned in the forum, but seems it is not relate to anything other than styles.xml content.
Any idea? why this not working
Upvotes: 0
Views: 473
Reputation: 578
I used Theme.AppCompat.Light.NoActionBar
and getSupportActionBar().hide()
but it doesn't work. And i find this way!
For No action bar Activity you just copy from a No_action_bar_Activity from some where else. For me I just create a Basic Activity android provide and delete the tool bar. Or you can find it on Github.
Do the same for ActionBar_Activity I think it is a bug on API 27
Upvotes: 0
Reputation: 891
Apply same them from manifest file.
<activity android:name=".SecondActivity" android:theme="Theme.AppCompat.Light.NoActionBar"/>
It will work definitely.
Upvotes: 0
Reputation: 11477
In the activity which is having actionBar use this code in onCreate()
getSupportActionBar().hide();
It will hide your actionBar
Upvotes: 0