Reputation: 2202
could anybody tell me how can I set a theme for my application which will change when version of Android will change. For example if anybody will use my app on Android 2.1 theme will look like this: http://daily-money.googlecode.com/svn/wiki/img/prefs.png
But if anybody will use my app on for example Android 4.0.3 theme will look like this: http://img.tapatalk.com/dcff019c-27ba-1e1a.jpg I have used minSDK 7.
Thank you.
Upvotes: 2
Views: 4623
Reputation: 768
@letroll, what parameter do you pass to setTheme? Does it require increasing min sdk to 13 to make the SDK available?
Upvotes: 0
Reputation: 200850
What you want is detailed in on this page: http://android-developers.blogspot.com/2012/01/holo-everywhere.html
In the section titled "Defaults for Older Apps"
You setup 2 theme files, one in the values directory and one in the values-v11 directory. Then you reference that theme file in the Manifest. As outlined in the page I linked above. You need ALL THREE blocks of XML outlined on that page under the "Using Holo while supporting Android 2.x" section.
Upvotes: 5
Reputation: 1078
first get the version of android running on the device :
if (android.os.Build.VERSION.SDK_INT >= 11) {
....
en after you can use setTheme(..) before calling setContentView(...)and super.oncreate() and it should work fine
Upvotes: 3