Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Material Design on older sdk

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?

like image 282
Caffeinatedwolf Avatar asked Sep 23 '14 11:09

Caffeinatedwolf


1 Answers

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 :)

like image 97
Inoy Avatar answered Sep 28 '22 21:09

Inoy