I'm using a custom background for my ActionBar. I followed the tutorial from here.
My styles.xml looks like this:
<resources>
<style name="MyTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">@style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">@color/actionbar_bg</item>
</style>
</resources>
I want this ActionBar to be displayed on each activity, except the login .. so I hid the ActionBar from my login activity (tut from: stackoverflow):
public class Login extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar actionBar = getSupportActionBar();
actionBar.hide();
In my manifest I added the custom theme ... like this:
<application
android:allowBackup="true"
android:label="@string/app_name"
android:theme="@style/MyTheme"
>
When I run the application, I get the error: You need to use a Theme.AppCompat theme (or descendant) with this activity
So I searched on stackoverflow for a solution. I had to extend Activity instead of ActionBarActivity. I did this, also on my Login Activity.
But now ... I can't hide the ActionBar anymore at my Login activity because it doesnt extend ActionBarActivity anymore .. so the following code:
ActionBar actionBar = getSupportActionBar();
Won't work .. anyone have an idea how to still Hide the actionbar at the Login activity, but still with a working custom Actionbartheme?
TL;DR: I want to use a custom actionbar, but I want to hide it on my Login activity. I can let the actionbar work, but only If I let my Login activity extend from Activity, instead of ActionBarActivity - This causes the getSupportActionBar(); to stop working, So I can't hide the actionbar anymore.