I had my app looking pretty nice using the new Lollipop tools. I decided backwards compatibility is important, so I switched all my Fragments,actionBar imports to the support library. Now (understandably) I can't use my lollipop theme.
Is there a way to use different action bars for different themes? I tried to cast the support ActionBar to a new one but it doesn't seem this is allowed.
My problem lies with the following (from v21 docs)
All of your Activities must extend from ActionBarActivity, which extends from FragmentActivity from the v4 support library, so you can continue to use fragments. All of your themes (that want an Action Bar/Toolbar) must inherit from Theme.AppCompat. There are variants available, including Light and NoActionBar. When inflating anything to be displayed on the action bar (such as a SpinnerAdapter for list navigation in the toolbar), make sure you use the action bar’s themed context, retrieved via getSupportActionBar().getThemedContext(). You must use the static methods in MenuItemCompat for any action-related calls on a MenuItem.
so by calling getsupportActionBar I can't use my Holo theme:
<resources> <!-- Base application theme. --> <style name="appTheme" parent="android:Theme.Holo.Light.DarkActionBar"> </style> <style name="MyActionBar" parent="android:Theme.Holo.Light.DarkActionBar"> <item name="android:background">@color/blue_semi_transparent</item> </style> </resources>
Also for some reason the action bar loses the button that was on it and it goes into the dropdown menu and the app icon no longer appears in the action bar. I really am no expert on this stuff having only started developing on lollipop so would really appreciate advice.