5

I see some application are already supporting material design. For example the SMS app Textra supports material design. And it works fine on my KitKat. How can I use the material design on older version of android. I get error when I use this

<resources>
<!-- your app's theme inherits from the Material theme -->
<style name="AppTheme" parent="android:Theme.Material">
<!-- theme customizations -->
</style>

Is there any solution?

Community
  • 1
  • 1
Caffeinatedwolf
  • 1,217
  • 3
  • 20
  • 26

3 Answers3

4

Well... there is a way. Here is a complex answer for you

Material Design from Android 2.2 (API 8) to present 5.0 (API 21)

Here what you need:

  1. Toolbar
  2. Material Design Library for widgets (buttons, checkboxes, etc)

1. Toolbar

Just get the idea and you ready to go.

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?attr/colorPrimaryDark"/>

Setup guide: http://antonioleiva.com/material-design-everywhere/

Source with example: https://github.com/antoniolg/MaterialEverywhere

To make Toolbar work lower API 11 use Theme.AppCompat.Light.NoActionBar (instead windowActionBar set to false)

<style name="NoActionBarTheme" parent="Theme.AppCompat.Light.NoActionBar">
     ...
</style>

2. Material Design Library

Here is Material Design Library for pretty buttons, etc.. Currently it's heavily developed.

Guide, code, example - https://github.com/navasmdc/MaterialDesignLibrary

Guide how to add library to Android Studio 1.0 - How do I import material design library to Android Studio?

.

Hope it helps :)

Community
  • 1
  • 1
Inoy
  • 1,065
  • 1
  • 17
  • 24
2

There is no direct approach as

<resources>
<!-- your app's theme inherits from the Material theme -->
<style name="AppTheme" parent="android:Theme.Material">
<!-- theme customizations -->
</style>

But in KitKat we can bring the look and feel of material theme without much effort by using Translucent UI.

FLAG_TRANSLUCENT_STATUS  or 
<item name="android:windowTranslucentNavigation">false</item>
<item name="android:windowTranslucentStatus">true</item>

Check this post for more information: material theme look and feel in KitKat

Harsha Vardhan
  • 3,324
  • 2
  • 17
  • 22
1

You can't use it in older version.

But for preventing error you can use specified folders for newer version of values. Put default style.xml in the values folder, and put specified style.xml for styles for kitkat in values-v19 folder. "Specified" means with attributes that are allowed only in API version 19+.

Orest Savchak
  • 4,529
  • 1
  • 18
  • 27
  • 2
    Are you sure, that they use material design ? As it is said on the developer.android.com: "The new material design features (like the material theme and activity transitions) are only available in the Android L Developer Preview. However, you can design your apps to make use of these features when running on devices with the Android L Developer Preview and still be compatible with previous releases of Android.". Maybe they just use own theme ? – Orest Savchak Sep 23 '14 at 11:50
  • I don't know how they did it. Maybe they make it look like that but on the description it says "Textra is the first messaging app that features the new Android L Material Design look you've heard so much about. It's delightful!" – Caffeinatedwolf Sep 23 '14 at 11:52
  • 1
    They can say anything. Compatibility of Material design does not allow to use it in older versions. They don't use any features of material design, so it is not a problem to make own custom theme that looks like this. For hiding status bar u can use this for min API 19: true – Orest Savchak Sep 23 '14 at 11:55
  • There is a support library now that should help you to use it on lower devices. – Janusz Nov 21 '14 at 09:25