Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Android L Material Design on KitKat

Reading the Compatibility section of Android L Developer Preview (http://developer.android.com/preview/material/compatibility.html) I've seen that i can create an APP using L-sdk and also be able to run it on older sdk (like KitKat).

I've created a new project using Android L sdk and configured "build.gradle" as said in this post: Android Studio : Failure [INSTALL_FAILED_OLDER_SDK].

I've tried both the configurations:

  • the one proposed in question that gives me this error:

    pkg: /data/local/tmp/com.example.{my user name}.materialapp Failure [INSTALL_FAILED_OLDER_SDK]

  • and the one proposed in answer that gives me error on

    <style name="AppTheme" parent="android:Theme.Material.Light"></style>

I've searched on others question on StackOverflow but I can't find no solutions.

SOLUTION: Android L preview material style can be used only on devices that run Android L. The "compatibility" is only a preview and it's not enabled.

like image 652
Luca Avatar asked Jul 08 '14 13:07

Luca


People also ask

Is Android KitKat still usable?

As of October 2020, 1.47% of Android devices run KitKat. As of August 2022, it is the oldest Android version still supported by Google Play Services and is currently the minimum version to develop apps for the Google Play Store.

What type of software is Android Kit Kat?

Android 4.4 KitKat is a version of Google's operating system (OS) for smartphones and tablets. The Android 4.4 KitKat operating system uses advanced memory optimization technologies. As a result, it is available on Android devices with as little as 512 MB of RAM.

Is material design a style Android?

Material design is a comprehensive guide for visual, motion, and interaction design across platforms and devices.


1 Answers

You have to create 2 different styles.xml files with the same name that you will put in different folders.

The first, will go here:

res/styles.xml

and will look NOT have a reference to the Material theme (use the Holo theme):

so would have something like this:

<style name="AppTheme" parent="android:Theme.Holo.Light"></style>

The second will go here:

res/values-v21/styles.xml

and WILL contain the reference to the new Material theme, and would have:

<style name="AppTheme" parent="android:Theme.Material.Light"></style>

The Android framework will automatically use the correct one depending on which API the device supports (so on API 21 devices it will use Material, and on all other devices, it will use whatever else you define).

like image 65
Booger Avatar answered Nov 10 '22 04:11

Booger