I don't really like Material design's spinner, and AppCompat doesn't contain the Holo Theme anymore. Should I revert back to AppCompat when it still supported Holo Theme or is there another way ?
With AppCompat v22, if you are using an AppCompatActivity you have to use an AppCompat theme.
If you try to use another theme you will receive:
Caused by: java.lang.IllegalStateException: You need to use a
Theme.AppCompat theme (or descendant) with this activity.
The only way to use a Holo Theme is to use a lower version.
e.g.
compile 'com.android.support:appcompat-v7:19.1.0'
Related
I have removed the ActionBarSherlock library and adapted my code.
Now I get errors in my style.xml
<style name="Theme.MyTheme" parent="Theme.Sherlock.Light">
What do I have to use instead of the Sherlock.light theme?
If you are using AppCompat library, use AppCompat.Light
#style/Theme.AppCompat.Light
else Try using Holo.Light.
#android:style/Theme.Holo.Light
If you are migrating to appcompat-v7, you need to migrate all Sherlock references to their corresponding AppCompat equivalents. This includes switching custom themes to inherit from Theme.AppCompat (e.g., Theme.AppCompat.Light).
You might consider installing Android Studio, then creating a scrap project using the new-project wizard. The defaults will use appcompat-v7, and you can examine the newly-created project to see what it uses, to help you determine how to change your Sherlock references.
I made a custom library. The library has a theme Theme_Amber. I added this library to my project. How can I be inherited in the application of the theme from the library?
I want to be inherited just as inherited from android theme
I wrote this
But the application crash with an error:
You need to use a Theme.AppCompat theme (or descendant) with this activity.
What am I doing wrong?
AppCompatActivity supports only Theme.AppCompat or themes inherited from Theme.AppCompat. If you want to use your custom theme, set it's parent theme as Theme.AppCompat.
I'm trying to create an app with android:Theme.Holo.Light and extending the Activity by AppCompatActivity. Android is throwing errors saying that I must use AppCompat theme.
My question is:
If I don't extend AppCompatActivity, I don't get material look in API level below 21 and if I extend Activity and set Holo theme, I don't get any errors but at the cost of missing the Material feel in the older devices. How do I overcome this limitation?
You need to use Theme.AppCompat if you are extending AppCompactActivity
You can use Theme.AppCompat. It is similar to Theme.Holo
setting the sdk minimum 15, should I use Theme.Holo and not Theme.AppCompat
And instead, it is always as if I had given compatibility for Android versions 2.1 and higher.
In this guide: http://developer.android.com/training/basics/actionbar/adding-buttons.html
when I have to add the search action, the ActionBar, are forced to use xmlns: yourapp = "http://schemas.android.com/apk/res-auto"
to be able to give the right showAsAction ...
Same problem to set the Holo theme, this is not available, and returns me error (You need to use a Theme.AppCompat theme with this activity), and are forced to use AppCompat.
I then tried to create a new project with SDK minimun 16, thinking that the problem was on the 15th, and when I go to
res \ values \ styles.xml
I always find parent = "Theme.AppCompat.Light.DarkActionBar"
The only way to use Holo, is creating a project with minimum 21 SDK.
The only way to not use AppCompat is to not use AppCompat. If you extend ActionBarActivity you have to use a theme that inherits from Theme.AppCompat. If you want to use Holo themes, you have to extend Activity.
While trying to update my app to a material design look, I added Appcompat v7 library to my project(last update), Everything works well for now but I'm forced to declare a theme in the manifest (wich I wasn't before working with Appcompat Lib).
Theme.AppCompat.Light
And when I change the theme in my app with
setTheme(pink);
the status bar color choosen with
name="colorPrimaryDark">#color/pink
stays the same color as in the theme declared in the manifest.
So here is my question how can I change the status bar color?
I found the proper solution to all this, the
setTheme(theme);
method should be called before
super.onCreate(savedInstanceState);
You can use getWindow().setStatusBarColor(color).