How set ICS theme for application with minSDK 7?

坚强是说给别人听的谎言 提交于 2019-12-03 20:41:43

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.

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

@letroll, what parameter do you pass to setTheme? Does it require increasing min sdk to 13 to make the SDK available?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!