How to maintain backwards compatibility while utilising Android API Level 15?

后端 未结 3 1197
一向
一向 2021-01-02 05:04

Ice cream sandwich introduced a lot of new UI design elements but market penetration is still only 4% or so. If one wanted to future-proof their application and utilise some

3条回答
  •  孤独总比滥情好
    2021-01-02 05:47

    This is a very, very broad topic. The answers vary depending on what specific element you're trying to use.

    -For the ActionBar: If you want an ActionBar in earlier versions, ActionBarSherlock is a popular, free library extended from the Android support library.

    -For the Color scheme / theme: As described in this SO thread, create a res/values/styles.xml and res/values-v11/styles.xml, (for instance, called "myStyle"), for each style pick a relevant parent. For V11, it would probably be "Theme.Holo", wheras for the other, probably "Theme.Dark". Add any customizations you want to the themes. Reference that custom theme in your manifest, and the right one will be chosen depending on the platform version of the device (values-v11 folder will be used for Honeycomb and up, the other for Gingerbread and below)

    -For other platform features, you can encapsulate platform-specific functionality in separate classes, and access them based on the value of Build.VERSION.SDK, as described on the android developer blog.

提交回复
热议问题