Professional Documents
Culture Documents
Material Design PDF
Material Design PDF
Material Design PDF
+Ran Nachmany
M AT E R I A L D E S I G N
A coherent cross-platform
experience
A coherent cross-platform
experience
Z
Elevation
The base Z-depth of a View
= !
+
Translation Z
!
view.animate().translationZ().start();
StateListAnimator
<ImageView
android:layout_width=wrap_content
android:layout_height=wrap_content
android:elevation="8dp"
android:stateListAnimator=@anim/my_state_list_animator
... />
<selector>
</selector>
StateListAnimator
anim/my_state_list_animator.xml
<selector>
<item android:state_pressed="true" android:state_enabled="true">
<objectAnimator android:propertyName="translationZ"
android:valueTo="8dp"
android:valueType="floatType"/>
</item>
</selector>
StateListAnimator
anim/my_state_list_animator.xml
<selector>
<item>
<objectAnimator android:propertyName="translationZ"
android:valueTo="0"
android:valueType="floatType"/>
</item>
</selector>
Outline
A views outline defines the shadow it casts
By default, the outline is derived from the views background
<shape android:shape="oval">
<solid android:color=@color/blue />
</shape>
Outline
But you can do much more with Outline.
Say you want an avatar clipped within a circle
scale
Display 3
!
Display 2
!
Display 1
!
Headline
!
Title
!
Subhead
!
Body 2
!
Body 1
!
Caption
!
Menu
!
Button
Typographic
Display 4
!
scale
Display 3
!
Display 2
!
Display 1
android:fontFamily=
!
Headline
sans-serif-medium
!
Title
!
Subhead
!
Body 2
!
Body 1
!
Caption
!
Menu
!
Button
Display 4
!
Display 3
!
Display 2
!
Display 1
android:TextAppearance.Material. !
Headline
!
Title
!
Subhead
!
Body 2
!
Body 1
!
Caption
!
Menu
!
Button
Display 4
!
Display 3
!
Display 2
!
Display 1
TextAppearance.AppCompat. !
Headline
!
Title
!
Subhead
!
Body 2
!
Body 1
!
Caption
!
Menu
!
Button
Bold
color
Primary
+
Accent
colorPrimaryDark
colorPrimary colorAccent
Theme.Material
API v21 and above
<style name=MyAwesomeTheme"
parent=android:Theme.Material.Light.DarkActionBar>
!
<item name="android:colorPrimary">@color/blue</item>
<item name=android:colorPrimaryDark">@color/darker_blue</item>
<item name=android:colorAccent">@color/teal</item>
!
</resources>
Theme.AppCompat
API v7 and above
<style name=MyAwesomeTheme"
parent=Theme.AppCompat.Light.DarkActionBar>
!
<item name="colorPrimary">@color/blue</item>
<item name="colorPrimaryDark">@color/darker_blue</item>
<item name="colorAccent">@color/teal</item>
!
</resources>
Content can
provide color
Light Vibrant Vibrant Dark Vibrant
getTitleTextColor() Title
ARGB color for legible title text over this Swatch Body
getBodyTextColor()
ARGB color for legible body text over this Swatch
getHsl() getPopulation()
The HSL value of this Swatch The relative amount of pixels this colour represents
3 Meaningful motion
Activity transitions
1. Enable the feature
layout/album_details.xml
<ImageView
...
android:transitionName="@string/transition_album_cover" />
Activity transitions
3. Start the Activity (transition)
Intent intent = ... // setup Intent as usual
!
String transitionName = getString(R.string.transition_album_cover);
!
ActivityOptionsCompat opts = ActivityOptionsCompat
.makeSceneTransitionAnimation(
activity, // Our starting Activity
albumCoverView, // The view which starts the transition
transitionName // The transitionName of the view were transitioning to
);
!
// Now start the Activity, using our options bundle
ActivityCompat.startActivity(activity, intent, opts.toBundle());
Asymmetric
motion
Users
initiate
change
RippleDrawable
New (v21+)
Unbounded
<ripple android:color=?android/colorControlHighlight />
Ripples
Bounded ripple
android:selectableItemBackground
android:selectableItemBackgroundBorderless
Circular Reveal
Circular Reveal
Animator reveal
= ViewAnimationUtils.createCircularReveal(
viewToReveal, // View to reveal
centerX, // mask centre x
centerY, // mask centre y
startRadius, // mask start radius
endRadius); // mask end radius
reveal.start();
4 Adaptive design
Keylines
Increments
64dp
56dp
Think in blocks
Toolbar
Toolbar
Toolbar
New (v21+)
<Toolbar
android:id=@+id/my_toolbar
android:layout_height=?android:actionBarSize
android:layout_width=match_parent
android:background=?android:colorPrimary />
<android.support.v7.widget.Toolbar
android:id=@+id/my_toolbar
android:layout_height=?actionBarSize
android:layout_width=match_parent
android:background=?colorPrimary />
<Toolbar
...>
!
<ProgressBar
...
android:gravity="top|end" />
!
</Toolbar>
M AT E R I A L D E S I G N
Q?