22
Material Design Anuchit Chalothorn [email protected]

09 material design

Embed Size (px)

Citation preview

Page 1: 09 material design

Material DesignAnuchit [email protected]

Page 2: 09 material design
Page 3: 09 material design
Page 4: 09 material design

Material Design for Android

Material design is a comprehensive guide for visual, motion, and interaction design across platforms and devices. See more in https://material.io/guidelines

Page 5: 09 material design

Elements

● New Theme ● New Widget eg: RecyclerView, CardView, Snackbar● New API for custom shadow, animation

Page 6: 09 material design

Material Design Template

Page 7: 09 material design
Page 8: 09 material design

Mobile Layout

Page 9: 09 material design

Tablet Layout

Page 10: 09 material design

Desktop Layout

Page 11: 09 material design

Vertical Divider & Horizontal Divider

Page 12: 09 material design

Cardview & Breaking and edge with FAB

Page 13: 09 material design

Material Design Theme

Use Material Design Palette to create your own theme

https://www.materialpalette.com

Page 14: 09 material design

<resources> <!-- inherit from the material theme --> <style name="AppTheme" parent="android:Theme.Material"> <!-- Main theme colors --> <!-- your app branding color for the app bar --> <item name="android:colorPrimary">@color/primary</item> <!-- darker variant for the status bar and contextual app bars --> <item name="android:colorPrimaryDark">@color/primary_dark</item> <!-- theme UI controls like checkboxes and text fields --> <item name="android:colorAccent">@color/accent</item> </style></resources>

Page 15: 09 material design

Codelab: Fragment replace

Start new project with navigation view, insert FrameLayout as a container, prepare for replace with FragmentActivity

Page 16: 09 material design

Fragment replace

MainFragment fragment = new MainFragment();

FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();

fragmentTransaction.replace(R.id.fragment_container,fragment);

fragmentTransaction.commit();

Page 17: 09 material design
Page 18: 09 material design

Recyclerview

Key concept to use RecyclerView

1. Add RecyclerView support library to the gradle build file2. Define a model class to use as the data source3. Add a RecyclerView to your activity to display the items4. Create a custom row layout XML file to visualize the item5. Create a RecyclerView.Adapter and ViewHolder to render the item6. Bind the adapter to the data source to populate the RecyclerView

Page 19: 09 material design

Listview with recyclerview

Use itemDecoration and DividerItemDecoration to create space between items

Page 20: 09 material design
Page 21: 09 material design

Cardview

Cardview use as RecyclerView but can handle with different layout

● LinearLayoutManager● GridLayoutManager● StaggeredGridLayoutManager

Page 22: 09 material design