How to create an Android application that can run on API 19 (4.4 Kitkat), but still looks like API 21 (5.0 Lollipop)?

I am creating an application, but I would like to upgrade it to the Android Lollipop design. I use Android Studio to develop my application, and I set the minimum SKD for API 21 (Lollipop), and I want it to work on Kitkat and Lollipop, so now I got the Lollipop interface and want to run it in Kitkat, but of course , perhaps because the minimum is Lollipop. And, as I expected, Kitkat did not run. So I changed the minimum SKD to 19 in build.gradle and the target SKD that I released (SKD 21), so Kitkat can now run the application, but the full layout is Kitkat style, not Lollipop. Even I made the app as a Lollipop design, and Android Studio viewed it as a Lollipop interface. I hope someone can help me get the Lollipop interface on Kitkat.

Thanks in advance.

+5
source share
2 answers

Unable to get "Lollipop interface on Kitkat". You can use appcompat-v7 backport , which will give you:

  • an action bar created in accordance with Material Design and, therefore, resembling, although not identical, the current action bar of Android 5.0+

  • shades applied to specific widgets

  • a Switch that looks like version of Android 5.0 Switch

  • a Toolbar backport

+3
source

You can implement the material design on Pre Lollipop devices using the Android support library appcompat_v7 rev21 , and then set the theme in AndroidManifest.xml as @android:style/Theme.Material (dark version) OR @android:style/Theme.Material.Light (light version) OR @android:style/Theme.Material.Light.DarkActionBar

Below are the official links for this:
https://developer.android.com/training/material/theme.html
https://developer.android.com/tools/support-library/features.html#v7

Hope this helps!

+2
source

Source: https://habr.com/ru/post/1210184/


All Articles