开发者

Creating an app which has extra functionality in v11 but still runs in v7

I've had a problem with this and have been running my head up against it and couldn't see how to use an ActionBar in the app when running on v11/3.0+ and then use an in house ActionBar in v7/2.1

开发者_C百科The problem is that when you use any of the tags (such as android:actionBarStyle) or libraries from v11 library, your app will no longer compile with a library lower than v11. Therefore you won't be able to run it on a phone.

However

I've been looking at the source to the Google IO 2011 application and it uses v7 as a default library. It is designed however to use the ActionBar as it has the above tag in it (android:actionBarStyle). But since I have a built version on my phone and it has alot of code for creating a fake ActionBar when on devices lower than v11 it obviously should be able to be built on both.

Obviously there is a peice of the puzzle I'm missing. How do I get the Google IO 2011 app building? What mechanism is in place which allows you to develop for multiple versions at once?

Someone please help.


Stupid Question which comes from confusing myself over 3 different issues I'm juggling.

Apps built with v11 library will happily run on a phone as long as the android:minSdkVersion attribute in the AndroidManifest.xml file has been set to or below the version of the phone. However, the functionality which relies on the later libraries won't work.

The reason I thought the Google IO 2011 app came with a default v7 library is that I created a project from the source in eclipse - I didn't import a project.

(And I'll write it here since I can - The Fragment code written into v11 code for convenience can't be used if you intent to use Fragments pre v11 as android.app.Fragment isn't compatible with android.support.v4.app.Fragment. It just needs to be ignored and hooks retrieved from getSupportManager() etc.).

So, I withdraw my question :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜