I'm designing the UI for an Android app taking the Google User Interface guidelines into account for my Android 4.0 phone.

The current concept looks like this:

How would I go about supporting this UI on older versions of Android? The tabs, ON/OFF switch buttons and other control styles are not available by default. Should I implement them myself? Is it acceptable to have a 4.0-like layout on older versions of Android (e.g. 2.1)?

  • Unrelated comment: you may want to style the "Reis plannen" button as a borderless button (see the Android Design site section on Buttons), aligned flush at the bottom of the screen, with centered text (optionally all caps, 12sp) Jun 14 '12 at 23:07
  • That is an excellent idea, I'll be sure to try it out.
    – Overv
    Jun 14 '12 at 23:17
  • I cannot answer your question, user... because you are headcrab zombie!
    – Ben Brocka
    Jun 21 '12 at 16:49

To answer your questions very directly:

Is it acceptable to have a 4.0-like layout on older versions of Android (e.g. 2.1)?

Yes. It's fine, in general, to use Holo styling on earlier versions of the platform. There are certainly elements of the Android 4.0 interaction palette that may be a bit jarring to users at first (for example the contextual action bar), but the Holo visual language is designed with every human in mind, not just the ones with Android 4.0 devices.

Should I implement them myself?

Yes, feel free to do so. The rest of this answer is developer specific, so may be best suited for Stack Overflow.

First, there's at least one open source project I know of that helps with bringing Holo styling to earlier devices, and another very popular one that helps with the action bar and action bar tabs.

If you want to do it yourself, most of the UI elements (buttons, spinners, checkboxes, etc.) are available on earlier versions of the OS. You just need to apply the Holo visual language, which involves copying resources from the framework (<sdk>/platforms/android-15/data/res/...) into your project and getting your <style> definitions right.

Two things to watch out for are tabs (action bar tabs are a 3.0+ feature) and toggle switches (Switch is a 4.0 widget). For tabs, it's fairly easy to create your own using Button widgets (you may want to avoid TabWidget since it's not easy to fully tweak its styling). For toggle switches, you can use a custom-styled ToggleButton or such.

  • 3
    There is another project to backport Switch widget : github.com/BoD/android-switch-backport
    – GBouerat
    Jun 15 '12 at 7:07
  • I was trying to answer this question with almost half of what has already been said by you Roman :D Lovely answer :)
    – Aman Alam
    Jun 15 '12 at 11:46
  • Just wanted to say that github.com/ChristopheVersieux/HoloEverywhere worked effortlessly for me, using this in my homebrew app.
    – Matthias
    Jun 19 '12 at 9:45
  • Holo Everywhere doesn't quite cover all Holo styled UI as some are hard-coded into Android widgets (such as ErrorPopup's background resources in TextView/EditText/CheckBox/etc.). For that ErrorPopup problem you can use github.com/coreform/android-formidable-validation to have an alternate ErrorPopup that you do have control of visually.
    – straya
    Jan 12 '13 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.