Google has released its new design guideline called Material Design with Android 5.0(Lollipop, API Level 21)
release with detailed guideline conatins lots of color, keyline, metrics, etc..
This library provides useful resources for applying Google's Material Design to your Android application.
You can get this library on the Maven Central repository. All you have to do is just adding com.androidhuman:support-material:0.1.2@aar
as a dependency to your build.gradle
file.
apply plugin: 'com.android.application'
android {
// Your application configurations...
}
dependencies {
// Other depedencies...
compile 'com.androidhuman:support-material:0.1.2@aar' // Add this line
}
Color values listed on Style > Color section.
Each item's name is formatted as mtrl_{COLOR_NAME}_{DEGREE}
. For instance, for Material Purple with degree of 500, its name will be mtrl_purple_500
.
####Usage in code
TextView tv = (TextView) findViewById(R.id.tv);
tv.setTextColor(getResources().getColor(R.color.mtrl_pink_500));
####Usage in resource
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorAccent">@color/mtrl_pink_a200</item>
<item name="colorPrimary">@color/mtrl_indigo_500</item>
<item name="colorPrimaryDark">@color/mtrl_indigo_700</item>
<item name="colorControlHighlight">@color/mtrl_blue_500</item>
<item name="colorControlNormal">@color/mtrl_grey_500</item>
</style>
</resources>
Typographic guidelines listed on Style > Typography section.
Since applying font family(android:fontFamily) is supported from API Level 16(Jellybean), applying material typo style also requires API Level 16 or higher.
Name | Style resource |
---|---|
Display 4 | @style/MaterialTextApperance.Display4 |
Display 3 | @style/MaterialTextApperance.Display3 |
Display 2 | @style/MaterialTextApperance.Display2 |
Display 1 | @style/MaterialTextApperance.Display1 |
Headline | @style/MaterialTextApperance.Headline |
Title | @style/MaterialTextApperance.Title |
Subhead | @style/MaterialTextApperance.Subhead |
Body 2 | @style/MaterialTextApperance.Body2 |
Body 1 | @style/MaterialTextApperance.Body1 |
Caption | @style/MaterialTextApperance.Caption |
Button | @style/MaterialTextApperance.Button |
Keylines and spacing listed on Layout > Metrics & keylines section.
List of supported items:
- Keylines
- Vertical spacing
See the usage in sample application, located at the samples
folder.
- Rename prefix 'material_' to 'mtrl_' in color values
- Keylines and vertical spacing support
- Fix missing attribute in
MaterialTextAppearance.Button
- Add Typography support
- Add sample application
- Initial, with Material Color palette support
Copyright 2014 Taeho Kim <jyte82@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.