1

I've tried my best to apply Material Design for Android SDK lower than 21, but I failed.
I downloaded appcompat-v7, added it to my maven file as:

<dependency>
    <groupId>com.android.support</groupId>
    <artifactId>appcompat-v7</artifactId>
    <version>21.0.0</version>
    <type>apklib</type>
</dependency>
<dependency>
    <groupId>com.android.support</groupId>
    <artifactId>appcompat-v7</artifactId>
    <version>21.0.0</version>
    <type>jar</type>
</dependency>

But Material Design is still unavailable. Is there any tutorial on how to do it? I want to make an application similar to Gmail version 5, but the SDK forces me to change API level to 21.

I'm only interested in layout. I do not want to use any other SDK 21 features. I'm using IntelliJ Idea and Maven. My target API level is 17

illright
  • 3,991
  • 2
  • 29
  • 54
shark
  • 995
  • 1
  • 8
  • 19
  • Have you seen this http://stackoverflow.com/questions/24633162/using-android-l-material-design-on-kitkat – zgc7009 Nov 15 '14 at 13:02
  • Yes, but here you have how to create two styles for different API levels. I want to use material desing on android 4.4 and use only controls, not any other API 21 features – shark Nov 15 '14 at 13:08

2 Answers2

3

May be, you could use this

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?

.

Have I answered your question?)

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

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

refe (Using Android L Material Design on KitKat)

Community
  • 1
  • 1
equerambug
  • 47
  • 3
  • 1
    but I want to display material always, in any API version. As I mentioned I want only to use controls (buttons, tabs ets) not any other API 21 features. – shark Jan 17 '15 at 11:16
  • 1
    http://android-developers.blogspot.com/2014/10/implementing-material-design-in-your.html – equerambug Jan 19 '15 at 05:55
  • I think that it will help me. I'll check and get you know. Thanks for link. – shark Jan 20 '15 at 08:27