Android Material Design, Android version 5 api 21, Android Tutorials '
This Tutorial Android Material Design

Next App Tutorial Coding a Layerlist with Elevation



If you are just arriving at this page; and you are not familiar with with creating Android Apps, we suggest you begin with our tutorials: Coding Android App Pages and How To Create a Simple App in Android

From there follow along with each tutorial lesson.

AIDE and ANDROID STUDIO

We are using AIDE(a mobile coding environment using language java/xml), to create these tutorial apps on our
tablet(7" screen) that has android version 5.0.
Once we build and RUN our app; we then install the app on this same tablet; and the app is also installed on a smart phone that has android version 6.
AIDE can be installed on any android version from 4 - 8.
We are using the AIDE coding editor to code our pages; and then to Create - RUN our apps. AIDE is a SDK coding environment for android devices like a tablet or smartphone. AIDE has a free and paid version. Once you create your apps code pages, you need to RUN the app to build your apk package; then you INSTALL it on your tablet or smartphone. For info on using AIDE, gohere

You can also create; RUN your apps using the code in these tutorials, with Android Studio. Android Studio is for desktop computers. Choose Java XML as the programming language. Android Studio is free to install and use for your android app development. Although not as convenient as testing your app on an actual android device; you can test your newly created app in Android Studio using its' android emulator.

Complete Example Codes are available for each of our tutorials. With these example codes you can make a functioning android app in either AIDE or Android Studio.



Android Material Design

Introduced in Android Version 5, API 21

Material Design is new code classes for developing android apps; included are:

New color blends for the UI interface;
Elevation for UI(user interface) elements;
The new material theme (light and dark);
View shadows;
RecyclerView widget;
CardView widget;
Floating Action Button(FAB);
SnackToast;
Drawable animation with styling effects;
Material design animation;
Activity transition effects;
Animators for view properties based on view states;
Customizable UI widgets and app bars with controllable color palettes;
Animated and non-animated drawables with XML vector graphics;
New widgets to create complex views;
New APIs to create custom shadows and animations.


COPY/PASTE CODE

First, create a java/xml android template app using AIDE, (or Android Studio). Then you can get the code for this app from the EXAMPLE CODE section on this page. Replace the code on the pages you need to(with our tutorial code); in order to create this app.
Sometimes, new pages have to be created.
All the other coded pages in your app can remain as they are; they don't need to be changed.


This is the App - Material Theme
It is the light theme of the material design theme; coded as material.theme.light; there is also a material.theme which is the dark color.

Material Design's Material Theme



Where - How - Why To Use Material Design

Material Design introduces new coding methods to use in your android app development. Some codes and concepts are entirely new, while others build upon previous code classes making them more functional and or improving their performance for your app.

Examples of this are the new RecyclerView and CardView widgets, which basically extend the capabilities of the previously known ListView.

For designing your UI; features include new functionality for fab buttons, the new ripple buttons and blended color charts; snacktoast messages, and elevated shadows for elements.

And for drawables and animations, there is now xml vector graphics, and drawable animations with styling effects.

Coding Themes - Holo and Material

For our app tutorial, we have added two themes, one for the new Material Theme theme light (light color version) and one for the holo theme light (also light in color). We have added both so that users with devices using the newer android platforms 5 and greater, will be shown the Material Theme's light theme, and users on android platforms less than version 5 will be shown the holo theme light theme. To code this in our app we must do this:

Create two styles.xml pages. They each have the same page name, that being: styles.xml. And, each page has exactly the same coding except for the theme names; Theme.Material.Light and Theme.Holo.Light.
Here are images showing the coding for each theme.
Theme Holo Light Code Holo Theme Code
Theme Material Light Code Material Design's Code Material Theme
To make each theme display accordingly to the android version being used we have to create a folder for the Material Theme, as such: res/values-v21, and put our styles.xml coded page for the Material Theme into the values-v21 folder. The 21 in the folder name stands for API 21 because android version 5.1 is api 21.

The styles.xml page for the Holo.Theme.Light is put into the app's default res/values folder.

Once we have coded the styles.xml pages and put them in their folders, we need to add the style name we gave our theme to the the AndroidManifest.xml file. We named it AppTheme so just add that name to the manifest file code as such:
android:theme="@style/AppTheme
Now the android system will display each theme depending on the android platform being used.

Additional Reading at these websites:

Android Developer Website: Material Design for Android
Designing Your App Using Material Design



Creating - Naming Your App Using AIDE

When creating your app,(from left menu) choose:
Create New Project;
Then, choose
New Android App(gradle, android Java/xml)
or
Hello World App Java/xml
if your using the original version of AIDE

You can name your app whatever you like; if your using the name as shown in our example code use;

Material Theme for the App Name and,
for the package name(next line) use:
com.aac.materialthemeExample

The Coded Pages


Code for the app - Material Theme

For this app you will use these coded pages:

LAYOUT File 1 layout file, main.xml; located at res/layout/main.xml, already created, just replace the code on this page with the code from our Example Code section and save the page.

JAVA File 1 java class page; MainActivity.java; located at app/src/java/MainActivity.java, already created; we don't need to add or edit code on this page so leave it as it is.

STYLES.XML Files 1 styles.xml for Theme.Holo.Light, already created when you created your android template app for this tutorial, located at res/values/styles.xml Since it's already been created, you don't have to do anything to this page code.

1 styles.xml for Theme.Material.Light, already created for you when you created your android template app for this tutorial; at res/values-v21/styles.xml
If however, you needed to create it; do this: First, create the folder, values-v21 at res/, then create the file styles.xml; just copy paste the code from our example code into the page to replace the code on page now, then save the page. Make sure to copy the Theme.Material.Light code.

Now you have your two styles.xml created. One for the holo theme and one for the material theme.
If a user with android version 5 or greater uses your app, then the Material Theme Light will display for them, and if a user on a android version less than 5 downloads and uses your app, then the Holo Theme Light will display for them.

STRINGS.XML File 1 strings.xml file, for text on our app page; file created for you when you created your android template app; just replace code that's there with code from our Example Code and save page.

ANDROIDMANIFEST.XML File 1 manifest file, AndroidManifest.xml (already created).
This is where you put the name of your theme, in this case the name given to it is AppTheme. This name is already in the androidmanfest.xml file, It was created for us when we created our template android app, so we don't need to edit this page.

In this file you can also code your SDK min and target versions for your app. These can also be coded in the build.gradle file of your app project. The important thing is that you code the version for the code your adding. In this app we are adding the material theme, from the Material Design coding classes; so we must use the SDK version for that code class which is SDK target version 21. This has already been coded for us when the app was created for us, so we don't have to add the SDK version or edit the page.

The material theme light color is similar to the holo.theme.light, so using either of these themes will give your app page a light color view.
If you want to use a darker color for your view you can use Material.Theme, which will show a dark color.
As mentioned in our previous tutorial on themes, you can add them to the entire app, or to individual pages in your app.

BUILD.GRADLE File The build.gradle. file is where you can define certain system requirements for your app; like coding your library support files;(dependencies); and your sdk min and target versions (especially important for material design compatibility). As mentioned, because we created our app with an android template app the build.gradle file was created for us and the SDK target version 21 has been added to the Config code in the page.

The build.gradle is a file you will likely use(code) more often as your gain experience coding android apps; especially if your adding Material Design code components to your apps; and want to make them compatible across all the android platform versions.

FYI:

Material Design
We know we need to add the SDK target version 21 to our build.gradle or androidmanifest.file for Material Design coding classes. Additionally, we need to add Support Libraries, also known as dependencies. Not every Material Design code class requires you to add a support library but many do.

These support libraries are added to the build.gradle file in your app project. Every app project you create with AIDE or Android Studio will have a build.gradle file.
Your app project actually has two build.gradle files; there's one we can edit and one we cannot edit.
The one we can edit and add our codes to is at src folder of your app project(in AIDE): at AppProjects/MaterialTheme/app/ and is named build.gradle. The other one has a header text saying 'DO NOT EDIT THIS FILE'
We have included in our EXAMPLE Code section; the build.gradle file from this tutorial so you can see what the code in the file looks like.


You can read additional info at the android developer website
Support Libraries

To add a library for a code class your adding to your app; you need to add a few lines of code, to the build.gradle file at the section named dependencies.
And, for any Material Design code classes, you also need to add the SDK version 21 as the target version in the androidmanifest.xml or build.gradle file. We will discuss the build.gradle file in another tutorial when we add some libraries.

Although you can add general libraries which cover more than one code class; it is recommended to only add the code class for the actual components your going to use in your app. This way, the apk(your app package file) does not contain unnecessary files.

These links from android developer website have more info you can read on adding library support for Material Design and the various libraries available that you can use.

Support Library Packages
Support Library Features Guide
Also Read:
Maintaining Compatibility Across Platforms
The Build Process

At this time, (May 2019)users of the various android platform versions are varied. Looking at this 'Platform Distribution Chart', you can see that android versions 5.1 to 8 are the most used platforms. They have about a 75% market share of android users. The most used platform as of May 2019 is version 6 with 21% of android users.
Chart of android platform distribution


EXAMPLE CODE - Code For This Tutorial

JUST USE YOUR MOUSE to copy the code for this tutorial App Name is 'Material Theme - located at AppProjects/MaterialTheme in AIDE, open the AIDE app, then open App Projects, THEN select the 'Material Theme', app from your files hierachy(left menu); then click on any file from the app, like strings.xml Make sure at top of page, the app name 'Material Theme' is there next to AppProjects like so: AppProjects/MaterialTheme, then you know you have the proper App.

Once a file is in the editor, you can edit, save it, then RUN your APP, Install, and Open your app.


Make sure you SAVED EACH PAGE,(or choose automatic saving in AIDE settings) before you RUN your code. SAVE, RUN, INSTALL, OPEN, your App. Once it has been installed on your tablet, you can open it Simply by Clicking on the Android little green App Icon,with the wording 'MaterialTheme' on your tablet. It will be with your other installed apps.

If you make further changes to this App, you need to SAVE, RUN, UPDATE, INSTALL, OPEN the app.





Example Code App - MaterialTheme :
Use Mouse To Copy Paste the Code


This free script provided by
JavaScript Kit

Share This Page


AIDE for creating Android Apps on your tablet or cell phone(android).
Free and Paid - with Free, create java/xml android template apps, and there is a couple free android coding lessons.
With paid, create java/xml android template apps, and you can create a 'keystore' for your app, so you can publish your apps to the marketplaces like Google Playstore and Amazon.
GoTo Aide

ANDROID STUDIO - for creating Android Apps on your desktop computer.
Free to Install and Use
GoTo Android Studio Learn more - Android Studio

The Java XML files we code(example codes) and the Android Apps we create in our Free Tutorials are compatible with Android Studio and AIDE. Just choose Java XML as your Programming Language.

You May Like:
Make Sushi Rolls Taste World Wines Flavours and Aromas



TUTORIALS I
Java XML
The Coded Pages

Beginners Article

About Our Tutorials

Coding androidmanifest.xml

Coding R.java

Coding buildconfig.java

Coding mainactivity.java

Coding main.xml

Coding strings.xml

Coding drawables

TUTORIALS II
Java XML
Learning To Code

Create A Simple
Android App

Change App Icon

Add Text and Style

Add Buttons To App

Placing Text in
Buttons


Change View
Background Color


Change Screen
Orientation


Add Image to
Activity View


Add Horizontal
Scroll View


Add a Frame Layout

How to Add Themes
To Your App


How To Code
Customized Styles


Code a Toast Message

Coding Resource
Identifiers



TUTORIALS III

Java XML
Adding Features,
Functionality

Coding Shape
Drawable - Lines


Coding A WebView

Coding A Timed
Screen Splash


Coding A Gradient
Drawable


Coding Fragments


Coding A
ListView Fragment


Coding a
Tabbed Fragment


Share Intent
for Text


Share Intent
for Images


Media Player
with Audio


Coding A
Video Player


Localize Your App
World Languages


Coding a Simple ListView

ListView with Toast Message

Android Sliding Drawer

Sliding Drawer
with ListView

TUTORIALS MATERIAL DESIGN
Java XML



What is Material
Design?


Coding a Material
Design Theme


Coding a Layer List
With Elevation


Shape Drawables
Elevate - Rotate


Scrollable Elevated
Topic Cards


Photo Containers
With Shadowed Container


Simple CardView

View Animator
with Photo Array


View Animator
With Views


Simple Frame Animation

Frame Animation
With Buttons


View Animation
Rotate, Scale, Translate


Android AppBar
ToolBar Design



from the Web
SPECIFIC CODING TASKS

Add Clickable Button
To textView

Image Button with
Selector


Linear Layout with
weight attribute


OnClick Displays
Message


Screen Density
Coding Practices



CODING ENVIRONMENTS


AIDE
for android tablets


Android Studio
For desktop computers



IMAGES ICONS FOR YOUR APPS

Code Canyon Paid From $1

IconFinder.com Free and Paid From $1


Our ARTICLES

App Distribution
Launching Your Android App
How To Be Successful


Android App Libraries
What are they and how
to implement them


ScrollView
How To Implement
ScrollView


View All Articles


Coding Tools

Android Studio
Course - Paid


Java Programming
Course - Free


Git Hub Course
Free



About Our Images

All images on this page are copyrighted material.
You can use the images included with each tutorial for the purpose of creating your android app. These images are not to be distributed or sold.

APP SIGNING KEY- GOOGLE


How To Add Your Google Key
To Manifest.xml
Web Article

How To Sign Your APK Web Article

Google Developer Console
Create Account Submit Your App
Web Article


APP SIGNING - AMAZON
Amazon App DRM - APK KEY
Amazon Developer Portal
Create Account - Submit Your App


MONETIZE YOUR APP
InMobi

AdMob

Google's In-App Billing for App monetization.

Monetizing Your App
How Tos




Follow Us On Twitter