I'm trying to make my ICS (API level 15) app compatible with Gingerbread (API level 10), and I'm getting InflateException Error inflating class <Unknown>
for any layout XML that has an ?android:attr/
attribute. If I comment out these attributes I can compile and run the app, but then it, of course, looks aweful.
I'd rather not duplicate all of the items from android.R.attr
that I'm using, but at the moment I'm lost as to another way to do it.
I'm using ActionBarSherlock to get the ActionBar working, and I don't seem to be using anything else that requires the support library (although I've included it during the process of trying to figure this out), it's just these theme-based resources that I'm stuck on.
Some of the theme resources I'm using are:
?android:attr/textColorSecondaryInverse
?android:attr/textAppearanceLarge
?android:attr/dividerVertical
?android:attr/selectableItemBackground
?android:attr/textAppearanceMedium
?android:attr/dividerVertical
?android:attr/dividerHorizontal
Please check android support v7 - appcompat project. It has many themes and attributes for backwards compatibility (attr/dividerHorizontal also)
http://developer.android.com/tools/support-library/features.html#v7-appcompat
To use v7 support you must import it as an Android lib project and reference to it from you project. It also contains v4 support so you may want to remove v4 support in your libs folder :) Good luck!!
As is in the documentation some styles are in higher API. For example:
dividerVertical
since API 11dividerHorizontal
since API 11?
mark is used to reference style in current theme.To deal with your problem you can:
values-v11
folder and support styles for older versions invalues
using custom values or different attributes from older API.It depends what's your aim. First suggestion makes sense when native style of application is important for you.
If you want to have Holo style everywhere then there is no way than copy it and use as a one style for all platforms.
Take a look at this project: https://github.com/Prototik/HoloEverywhere
to use styles from API 11 Specifically android:attr/textAppearanceMedium ?android:attr/dividerVertical ?android:attr/dividerHorizontal
The easiest way is to use following code where ever your required