SlideShare a Scribd company logo
1 of 112
Download to read offline
Material Design 
Backwards Compatibility
2 
About Me 
• Mobile Development 
• Android 
• iOS 
• REST-Api Design 
• Cloud Infrastructure 
+Angelo Rüggeberg 
@s3xy4ngyc 
http://s3xy4ngyc.github.io
Sample app 
• Source Available at 
Github: 
https://github.com/ 
s3xy4ngyc/Android-L-Samples 
• Available at Google Play: 
https://play.google.com/ 
store/apps/details? 
id=s3xy.de.lsamples 
3
4
Distribution 
5
Distribution 
6
Distribution 
• Devices having Android 5.0 officially: 
• Nexus 5 
• Nexus 7 
• Nexus 9 
• LG G3 
6
Distribution 
7
Distribution 
7
Dependencies 
8
9
9 
dependencies { 
compile 'com.android.support:support-v4:21.0.2' 
compile 'com.android.support:appcompat-v7:21.0.2' 
compile 'com.android.support:cardview-v7:21.0.2' 
compile 'com.android.support:recyclerview-v7:21.0.2' 
compile 'com.android.support:gridlayout-v7:21.0.2' 
compile 'com.android.support:mediarouter-v7:21.0.2' 
compile 'com.android.support:palette-v7:21.0.2' 
compile 'com.android.support:support-v13:21.0.2' 
compile 'com.android.support:leanback-v17:21.0.2' 
compile 'com.android.support:support-annotations:21.0.2' 
}
9 
dependencies { 
compile 'com.android.support:support-v4:21.0.2' 
compile 'com.android.support:appcompat-v7:21.0.2' 
compile 'com.android.support:cardview-v7:21.0.2' 
compile 'com.android.support:recyclerview-v7:21.0.2' 
compile 'com.android.support:gridlayout-v7:21.0.2' 
compile 'com.android.support:mediarouter-v7:21.0.2' 
compile 'com.android.support:palette-v7:21.0.2' 
compile 'com.android.support:support-v13:21.0.2' 
compile 'com.android.support:leanback-v17:21.0.2' 
compile 'com.android.support:support-annotations:21.0.2' 
} 
‚//material Theme, ActionBar, etc.
9 
dependencies { 
compile 'com.android.support:support-v4:21.0.2' 
compile 'com.android.support:appcompat-v7:21.0.2' 
compile 'com.android.support:cardview-v7:21.0.2' 
compile 'com.android.support:recyclerview-v7:21.0.2' 
compile 'com.android.support:gridlayout-v7:21.0.2' 
compile 'com.android.support:mediarouter-v7:21.0.2' 
compile 'com.android.support:palette-v7:21.0.2' 
compile 'com.android.support:support-v13:21.0.2' 
compile 'com.android.support:leanback-v17:21.0.2' 
compile 'com.android.support:support-annotations:21.0.2' 
} 
‚//material Theme, ActionBar, etc. 
‚//New Components for Pre 5.0
Apply Material 
Theme 
10
11
11 
android: 
Theme.Material
11 
android: 
Theme.Material 
android: 
Theme.Material.Light
Theme.AppCompat Theme.AppCompat.Light 
11 
android: 
Theme.Material 
android: 
Theme.Material.Light
Apply Material Theme 
12
Apply Material Theme 
• Custom Style Extending Appcompat Style 
12
Apply Material Theme 
• Custom Style Extending Appcompat Style 
• Things to note: 
12
Apply Material Theme 
• Custom Style Extending Appcompat Style 
• Things to note: 
• No more @android duplicates 
12
Apply Material Theme 
• Custom Style Extending Appcompat Style 
• Things to note: 
• No more @android duplicates 
• No more v14+ Style Folder 
12
13
13
13
13
13
13
13
Apply Material Theme 
14
Apply Material Theme 
• Ui Elements that Get Material Design: 
• EditText 
• Spinner 
• CheckBox 
• RadioButton 
• Switch 
• CheckedTextView 
14
Apply Material Theme 
• Ui Elements that Get Material Design: 
• EditText 
• Spinner 
• CheckBox 
• RadioButton 
• Switch 
• CheckedTextView 
• All Other UI Elements do not get Styled 
and Need Custom Styling/Views 
14
Action Bar Drawer 
Toggle 
15
16 
Action Bar Drawer Toggle
16 
Action Bar Drawer Toggle
Action Bar Drawer Toggle 
17
Action Bar Drawer Toggle 
• import 
android.support.v7.app.ActionBarDrawerT 
oggle 
• Extend from ActionBarActivity 
• Init DrawerToggle with Drawer Layout 
• Assign DrawerToggle to DrawerLayout 
17
18
18 
DrawerLayout mDrawerLayout; 
ActionBarDrawerToggle drawerToggle; 
@Override 
protected void onCreate(Bundle savedInstanceState) { 
super.onCreate(savedInstanceState); 
setContentView(R.layout.activity_my); 
drawerToggle = new ActionBarDrawerToggle(this, 
mDrawerLayout, 
R.string.app_name, 
R.string.app_name) { 
}; 
mDrawerLayout.setDrawerListener(drawerToggle); 
getSupportActionBar().setDisplayHomeAsUpEnabled(true); 
getSupportActionBar().setHomeButtonEnabled(true); 
}
18 
DrawerLayout mDrawerLayout; 
ActionBarDrawerToggle drawerToggle; 
@Override 
protected void onCreate(Bundle savedInstanceState) { 
super.onCreate(savedInstanceState); 
setContentView(R.layout.activity_my); 
drawerToggle = new ActionBarDrawerToggle(this, 
mDrawerLayout, 
R.string.app_name, 
R.string.app_name) { 
}; 
mDrawerLayout.setDrawerListener(drawerToggle); 
getSupportActionBar().setDisplayHomeAsUpEnabled(true); 
getSupportActionBar().setHomeButtonEnabled(true); 
}
18 
DrawerLayout mDrawerLayout; 
ActionBarDrawerToggle drawerToggle; 
@Override 
protected void onCreate(Bundle savedInstanceState) { 
super.onCreate(savedInstanceState); 
setContentView(R.layout.activity_my); 
drawerToggle = new ActionBarDrawerToggle(this, 
mDrawerLayout, 
R.string.app_name, 
R.string.app_name) { 
}; 
mDrawerLayout.setDrawerListener(drawerToggle); 
getSupportActionBar().setDisplayHomeAsUpEnabled(true); 
getSupportActionBar().setHomeButtonEnabled(true); 
}
18 
DrawerLayout mDrawerLayout; 
ActionBarDrawerToggle drawerToggle; 
@Override 
protected void onCreate(Bundle savedInstanceState) { 
super.onCreate(savedInstanceState); 
setContentView(R.layout.activity_my); 
drawerToggle = new ActionBarDrawerToggle(this, 
mDrawerLayout, 
R.string.app_name, 
R.string.app_name) { 
}; 
mDrawerLayout.setDrawerListener(drawerToggle); 
getSupportActionBar().setDisplayHomeAsUpEnabled(true); 
getSupportActionBar().setHomeButtonEnabled(true); 
}
18 
DrawerLayout mDrawerLayout; 
ActionBarDrawerToggle drawerToggle; 
@Override 
protected void onCreate(Bundle savedInstanceState) { 
super.onCreate(savedInstanceState); 
setContentView(R.layout.activity_my); 
drawerToggle = new ActionBarDrawerToggle(this, 
mDrawerLayout, 
R.string.app_name, 
R.string.app_name) { 
}; 
mDrawerLayout.setDrawerListener(drawerToggle); 
getSupportActionBar().setDisplayHomeAsUpEnabled(true); 
getSupportActionBar().setHomeButtonEnabled(true); 
}
Card View 
19
Card View 
20
Card View 
• Support for rounded Corners 
• Elevation Shadows 
20
Card View 
• Support for rounded Corners 
• Elevation Shadows 
• Limitations: 
• On Pre-L no Clipping for Children with 
Round Corners 
• On Pre-L Adds Padding to Draw 
Shadows 
20
21
22
22 
<?xml version="1.0" encoding="utf-8"?> 
<android.support.v7.widget.CardView 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:id="@+id/cardView" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:layout_margin="5dp" 
android:background="?android:selectableItemBackground" 
app:cardCornerRadius="2dp" 
app:cardElevation="5dp" 
app:cardPreventCornerOverlap="true" 
app:cardUseCompatPadding="true"> 
<!-- Place Your Textviews etc. in here --> 
<LinearLayout...> 
</android.support.v7.widget.CardView>
Recycler View 
23
Recycler View 
24
Recycler View 
• „Replacement“ for ListView 
• Implements the ViewHolderPattern 
• Improved Recycling 
• LayoutManager 
• Vertical List View 
• Horizontal List View 
• Staggered Grid View 
24
25
25 
Layout:
25 
Layout:
25 
Layout: 
Code:
25 
Layout: 
Code:
26
27 
Recycler View - Adapter
27 
Recycler View - Adapter 
Old Adapter: 
class MenuAdapterOld extends ArrayAdapter<String> {
27 
Recycler View - Adapter 
Old Adapter: 
class MenuAdapterOld extends ArrayAdapter<String> { 
New Adapter: 
import android.support.v7.widget.RecyclerView; 
public class MenuAdapter extends RecyclerView.Adapter<MenuAdapter.ViewHolder> {
28 
Recycler View - Adapter
28 
private ArrayList<String> mDataset; 
private OnItemClickListener mListener; 
public MenuAdapter(ArrayList<String> myDataset, OnItemClickListener listener) { 
mDataset = myDataset; 
mListener = listener; 
} 
Recycler View - Adapter
29 
Recycler View - Adapter
29 
private ArrayList<String> mDataset; 
private OnItemClickListener mListener; 
public MenuAdapter(ArrayList<String> myDataset, OnItemClickListener listener) { 
mDataset = myDataset; 
mListener = listener; 
} 
Recycler View - Adapter
29 
private ArrayList<String> mDataset; 
private OnItemClickListener mListener; 
public MenuAdapter(ArrayList<String> myDataset, OnItemClickListener listener) { 
mDataset = myDataset; 
mListener = listener; 
} 
Recycler View - Adapter
29 
private ArrayList<String> mDataset; 
private OnItemClickListener mListener; 
public MenuAdapter(ArrayList<String> myDataset, OnItemClickListener listener) { 
mDataset = myDataset; 
mListener = listener; 
} 
Recycler View - Adapter 
@Override 
public int getItemCount() { 
return mDataset.size(); 
}
30 
Recycler View - Adapter
30 
public static class ViewHolder extends RecyclerView.ViewHolder { 
ImageView mPhoto; 
TextView mPhotoTitle; 
CardView mCardView; 
public ViewHolder(View itemView) { 
super(itemView); 
mPhoto = (ImageView) itemView.findViewById(R.id.photo); 
mPhotoTitle = (TextView) itemView.findViewById(R.id.photoTitle); 
mCardView = (CardView) itemView.findViewById(R.id.cardView); 
} 
} 
Recycler View - Adapter
30 
public static class ViewHolder extends RecyclerView.ViewHolder { 
ImageView mPhoto; 
TextView mPhotoTitle; 
CardView mCardView; 
public ViewHolder(View itemView) { 
super(itemView); 
mPhoto = (ImageView) itemView.findViewById(R.id.photo); 
mPhotoTitle = (TextView) itemView.findViewById(R.id.photoTitle); 
mCardView = (CardView) itemView.findViewById(R.id.cardView); 
} 
} 
Recycler View - Adapter
30 
public static class ViewHolder extends RecyclerView.ViewHolder { 
ImageView mPhoto; 
TextView mPhotoTitle; 
CardView mCardView; 
public ViewHolder(View itemView) { 
super(itemView); 
mPhoto = (ImageView) itemView.findViewById(R.id.photo); 
mPhotoTitle = (TextView) itemView.findViewById(R.id.photoTitle); 
mCardView = (CardView) itemView.findViewById(R.id.cardView); 
} 
} 
Recycler View - Adapter
30 
public static class ViewHolder extends RecyclerView.ViewHolder { 
ImageView mPhoto; 
TextView mPhotoTitle; 
CardView mCardView; 
public ViewHolder(View itemView) { 
super(itemView); 
mPhoto = (ImageView) itemView.findViewById(R.id.photo); 
mPhotoTitle = (TextView) itemView.findViewById(R.id.photoTitle); 
mCardView = (CardView) itemView.findViewById(R.id.cardView); 
} 
} 
Recycler View - Adapter
30 
public static class ViewHolder extends RecyclerView.ViewHolder { 
ImageView mPhoto; 
TextView mPhotoTitle; 
CardView mCardView; 
public ViewHolder(View itemView) { 
super(itemView); 
mPhoto = (ImageView) itemView.findViewById(R.id.photo); 
mPhotoTitle = (TextView) itemView.findViewById(R.id.photoTitle); 
mCardView = (CardView) itemView.findViewById(R.id.cardView); 
} 
} 
Recycler View - Adapter
31 
Recycler View - Adapter
31 
@Override 
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { 
View v = LayoutInflater.from(viewGroup.getContext()).inflate(rowLayout, viewGroup, 
false); 
return new ViewHolder(v); 
} 
@Override 
public void onBindViewHolder(final ViewHolder viewHolder, final int i) { 
Photo p = photos.get(i); 
mPicasso.load(p.getUrl()).error(android.R.drawable.stat_notify_error).placeholder(android.R. 
drawable.stat_notify_sync).into(viewHolder.mPhoto); 
viewHolder.mPhotoTitle.setText(p.getId()); 
if (viewHolder.mPhotographerTitle != null) { 
viewHolder.mPhotographerTitle.setText(p.getTitle()); 
} 
viewHolder.mCardView.setOnClickListener(new View.OnClickListener() { 
@Override 
public void onClick(View v) { 
mListener.onClick(viewHolder.mPhoto, i); 
} 
}); 
} 
Recycler View - Adapter
31 
@Override 
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { 
View v = LayoutInflater.from(viewGroup.getContext()).inflate(rowLayout, viewGroup, 
false); 
return new ViewHolder(v); 
} 
@Override 
public void onBindViewHolder(final ViewHolder viewHolder, final int i) { 
Photo p = photos.get(i); 
mPicasso.load(p.getUrl()).error(android.R.drawable.stat_notify_error).placeholder(android.R. 
drawable.stat_notify_sync).into(viewHolder.mPhoto); 
viewHolder.mPhotoTitle.setText(p.getId()); 
if (viewHolder.mPhotographerTitle != null) { 
viewHolder.mPhotographerTitle.setText(p.getTitle()); 
} 
viewHolder.mCardView.setOnClickListener(new View.OnClickListener() { 
@Override 
public void onClick(View v) { 
mListener.onClick(viewHolder.mPhoto, i); 
} 
}); 
} 
Recycler View - Adapter
31 
@Override 
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { 
View v = LayoutInflater.from(viewGroup.getContext()).inflate(rowLayout, viewGroup, 
false); 
return new ViewHolder(v); 
} 
@Override 
public void onBindViewHolder(final ViewHolder viewHolder, final int i) { 
Photo p = photos.get(i); 
mPicasso.load(p.getUrl()).error(android.R.drawable.stat_notify_error).placeholder(android.R. 
drawable.stat_notify_sync).into(viewHolder.mPhoto); 
viewHolder.mPhotoTitle.setText(p.getId()); 
if (viewHolder.mPhotographerTitle != null) { 
viewHolder.mPhotographerTitle.setText(p.getTitle()); 
} 
viewHolder.mCardView.setOnClickListener(new View.OnClickListener() { 
@Override 
public void onClick(View v) { 
mListener.onClick(viewHolder.mPhoto, i); 
} 
}); 
} 
Recycler View - Adapter
31 
@Override 
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { 
View v = LayoutInflater.from(viewGroup.getContext()).inflate(rowLayout, viewGroup, 
false); 
return new ViewHolder(v); 
} 
@Override 
public void onBindViewHolder(final ViewHolder viewHolder, final int i) { 
Photo p = photos.get(i); 
mPicasso.load(p.getUrl()).error(android.R.drawable.stat_notify_error).placeholder(android.R. 
drawable.stat_notify_sync).into(viewHolder.mPhoto); 
viewHolder.mPhotoTitle.setText(p.getId()); 
if (viewHolder.mPhotographerTitle != null) { 
viewHolder.mPhotographerTitle.setText(p.getTitle()); 
} 
viewHolder.mCardView.setOnClickListener(new View.OnClickListener() { 
@Override 
public void onClick(View v) { 
mListener.onClick(viewHolder.mPhoto, i); 
} 
}); 
} 
Recycler View - Adapter
31 
@Override 
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { 
View v = LayoutInflater.from(viewGroup.getContext()).inflate(rowLayout, viewGroup, 
false); 
return new ViewHolder(v); 
} 
@Override 
public void onBindViewHolder(final ViewHolder viewHolder, final int i) { 
Photo p = photos.get(i); 
mPicasso.load(p.getUrl()).error(android.R.drawable.stat_notify_error).placeholder(android.R. 
drawable.stat_notify_sync).into(viewHolder.mPhoto); 
viewHolder.mPhotoTitle.setText(p.getId()); 
if (viewHolder.mPhotographerTitle != null) { 
viewHolder.mPhotographerTitle.setText(p.getTitle()); 
} 
viewHolder.mCardView.setOnClickListener(new View.OnClickListener() { 
@Override 
public void onClick(View v) { 
mListener.onClick(viewHolder.mPhoto, i); 
} 
}); 
} 
Recycler View - Adapter
32
32 
• Linear Layout 
Manager
32 
• Linear Layout 
Manager 
• Supports Smooth 
Scrolling
32 
• Linear Layout 
Manager 
• Supports Smooth 
Scrolling
33
33 
• Linear Layout 
Manager
33 
• Linear Layout 
Manager 
• Orientation 
Horizontal
33 
• Linear Layout 
Manager 
• Orientation 
Horizontal
34
34 
• Staggered Grid Layout 
Manager
34 
• Staggered Grid Layout 
Manager 
• Grid Size can be 
defined
34 
• Staggered Grid Layout 
Manager 
• Grid Size can be 
defined 
• Supports Vertical and 
Horizontal Scrolling
34 
• Staggered Grid Layout 
Manager 
• Grid Size can be 
defined 
• Supports Vertical and 
Horizontal Scrolling
Toolbar 
35
Toolbar 
37
Toolbar 
• ActionBar == Toolbar 
• Toolbar is a ViewGroup 
• Styleable 
• Positionable 
37
38 
Layout: 
Code:
39 
Standalone Widget:
Limitations 
40
Limitations 
41
Limitations 
• Activity Transitions are Possible, BUT 
won’t be applied on PRE 5.0 Devices 
• Many „New“ Ui Elements are not available 
in the API, thus require separate 
Implementation/Style. 
41
Limitations 
42
Limitations 
• Elements not Included: 
• Fancy Material Progressbars 
• Buttons 
• Flat 
• Raised 
• Round / Floating 
• Sliders 
• Snackbars 
42
Limitations 
43
Limitations 
• Things not Supported on Pre 5.0: 
• Activity transitions 
• Touch feedback 
• Reveal animations 
• Path-based animations 
• Vector drawables 
• Drawable tinting 
43
44 
Useful Links
Useful Links 
• Official Documentation: 
http://developer.android.com/tools/ 
support-library/index.html 
• Index for Open Source Libraries: 
https://android-arsenal.com/ 
• e.G. Missing Ui Elements 
45
Questions? 
AngeloRüggeberg 
twitter.com/ 
s3xy4ngyc 
google.com/+ 
s3xy4ngyc 
.github.io 
github.com/ 
s3xy4ngyc

More Related Content

What's hot

Android - Intents and Broadcast Receivers
Android - Intents and Broadcast ReceiversAndroid - Intents and Broadcast Receivers
Android - Intents and Broadcast ReceiversMingHo Chang
 
Android Sliding Menu dengan Navigation Drawer
Android Sliding Menu dengan Navigation DrawerAndroid Sliding Menu dengan Navigation Drawer
Android Sliding Menu dengan Navigation DrawerAgus Haryanto
 
Improving android experience for both users and developers
Improving android experience for both users and developersImproving android experience for both users and developers
Improving android experience for both users and developersPavel Lahoda
 
Droidcon2013 android experience lahoda
Droidcon2013 android experience lahodaDroidcon2013 android experience lahoda
Droidcon2013 android experience lahodaDroidcon Berlin
 
Sword fighting with Dagger GDG-NYC Jan 2016
 Sword fighting with Dagger GDG-NYC Jan 2016 Sword fighting with Dagger GDG-NYC Jan 2016
Sword fighting with Dagger GDG-NYC Jan 2016Mike Nakhimovich
 
I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)Katsumi Kishikawa
 
Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)Alfredo Morresi
 
Capture image on eye blink
Capture image on eye blinkCapture image on eye blink
Capture image on eye blinkInnovationM
 
Building Robust jQuery Plugins
Building Robust jQuery PluginsBuilding Robust jQuery Plugins
Building Robust jQuery PluginsJörn Zaefferer
 
Android training day 4
Android training day 4Android training day 4
Android training day 4Vivek Bhusal
 
3D Touch: Preparando sua app para o futuro do iOS
3D Touch: Preparando sua app para o futuro do iOS3D Touch: Preparando sua app para o futuro do iOS
3D Touch: Preparando sua app para o futuro do iOSRodrigo Borges
 
前端MVC 豆瓣说
前端MVC 豆瓣说前端MVC 豆瓣说
前端MVC 豆瓣说Ting Lv
 

What's hot (20)

Action bar
Action barAction bar
Action bar
 
Android - Intents and Broadcast Receivers
Android - Intents and Broadcast ReceiversAndroid - Intents and Broadcast Receivers
Android - Intents and Broadcast Receivers
 
Solid angular
Solid angularSolid angular
Solid angular
 
ButterKnife
ButterKnifeButterKnife
ButterKnife
 
Android Sliding Menu dengan Navigation Drawer
Android Sliding Menu dengan Navigation DrawerAndroid Sliding Menu dengan Navigation Drawer
Android Sliding Menu dengan Navigation Drawer
 
Understanding angular meteor
Understanding angular meteorUnderstanding angular meteor
Understanding angular meteor
 
Improving android experience for both users and developers
Improving android experience for both users and developersImproving android experience for both users and developers
Improving android experience for both users and developers
 
Droidcon2013 android experience lahoda
Droidcon2013 android experience lahodaDroidcon2013 android experience lahoda
Droidcon2013 android experience lahoda
 
Sword fighting with Dagger GDG-NYC Jan 2016
 Sword fighting with Dagger GDG-NYC Jan 2016 Sword fighting with Dagger GDG-NYC Jan 2016
Sword fighting with Dagger GDG-NYC Jan 2016
 
Android For All The Things
Android For All The ThingsAndroid For All The Things
Android For All The Things
 
Action Bar in Android
Action Bar in AndroidAction Bar in Android
Action Bar in Android
 
RxBinding-kotlin
RxBinding-kotlinRxBinding-kotlin
RxBinding-kotlin
 
I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)
 
Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)
 
Capture image on eye blink
Capture image on eye blinkCapture image on eye blink
Capture image on eye blink
 
Building Robust jQuery Plugins
Building Robust jQuery PluginsBuilding Robust jQuery Plugins
Building Robust jQuery Plugins
 
Fun with RecyclerView
Fun with RecyclerViewFun with RecyclerView
Fun with RecyclerView
 
Android training day 4
Android training day 4Android training day 4
Android training day 4
 
3D Touch: Preparando sua app para o futuro do iOS
3D Touch: Preparando sua app para o futuro do iOS3D Touch: Preparando sua app para o futuro do iOS
3D Touch: Preparando sua app para o futuro do iOS
 
前端MVC 豆瓣说
前端MVC 豆瓣说前端MVC 豆瓣说
前端MVC 豆瓣说
 

Viewers also liked

Deep Dive Into Android Design Support Library And AppCompat
Deep Dive Into Android Design Support Library And AppCompatDeep Dive Into Android Design Support Library And AppCompat
Deep Dive Into Android Design Support Library And AppCompatFernando Cesar da Silva
 
What’s new for Android Developers in 2015 - Material Design, Android Studio, ...
What’s new for Android Developers in 2015 - Material Design, Android Studio, ...What’s new for Android Developers in 2015 - Material Design, Android Studio, ...
What’s new for Android Developers in 2015 - Material Design, Android Studio, ...Deepu S Nath
 
Hacking Android [MUC:SEC 20.05.2015]
Hacking Android [MUC:SEC 20.05.2015]Hacking Android [MUC:SEC 20.05.2015]
Hacking Android [MUC:SEC 20.05.2015]Angelo Rüggeberg
 
Implementacja Material Design na Android Lollipop i starszych - MTC 2015
Implementacja Material Design na Android Lollipop i starszych - MTC 2015Implementacja Material Design na Android Lollipop i starszych - MTC 2015
Implementacja Material Design na Android Lollipop i starszych - MTC 2015Sylwester Madej
 
Android Lollipop and Material Design
Android Lollipop and Material DesignAndroid Lollipop and Material Design
Android Lollipop and Material DesignJames Montemagno
 
Material for old school
Material for old schoolMaterial for old school
Material for old schoolJorge Barroso
 

Viewers also liked (7)

Deep Dive Into Android Design Support Library And AppCompat
Deep Dive Into Android Design Support Library And AppCompatDeep Dive Into Android Design Support Library And AppCompat
Deep Dive Into Android Design Support Library And AppCompat
 
What’s new for Android Developers in 2015 - Material Design, Android Studio, ...
What’s new for Android Developers in 2015 - Material Design, Android Studio, ...What’s new for Android Developers in 2015 - Material Design, Android Studio, ...
What’s new for Android Developers in 2015 - Material Design, Android Studio, ...
 
Material design
Material designMaterial design
Material design
 
Hacking Android [MUC:SEC 20.05.2015]
Hacking Android [MUC:SEC 20.05.2015]Hacking Android [MUC:SEC 20.05.2015]
Hacking Android [MUC:SEC 20.05.2015]
 
Implementacja Material Design na Android Lollipop i starszych - MTC 2015
Implementacja Material Design na Android Lollipop i starszych - MTC 2015Implementacja Material Design na Android Lollipop i starszych - MTC 2015
Implementacja Material Design na Android Lollipop i starszych - MTC 2015
 
Android Lollipop and Material Design
Android Lollipop and Material DesignAndroid Lollipop and Material Design
Android Lollipop and Material Design
 
Material for old school
Material for old schoolMaterial for old school
Material for old school
 

Similar to Material Design and Backwards Compatibility

Android Support Library: Using ActionBarCompat
Android Support Library: Using ActionBarCompatAndroid Support Library: Using ActionBarCompat
Android Support Library: Using ActionBarCompatcbeyls
 
Android UI Development: Tips, Tricks, and Techniques
Android UI Development: Tips, Tricks, and TechniquesAndroid UI Development: Tips, Tricks, and Techniques
Android UI Development: Tips, Tricks, and TechniquesEdgar Gonzalez
 
Android UI Tips, Tricks and Techniques
Android UI Tips, Tricks and TechniquesAndroid UI Tips, Tricks and Techniques
Android UI Tips, Tricks and TechniquesMarakana Inc.
 
Android Design Patterns
Android Design PatternsAndroid Design Patterns
Android Design PatternsGodfrey Nolan
 
Android TV: Building apps with Google’s Leanback Library
Android TV: Building apps with  Google’s Leanback LibraryAndroid TV: Building apps with  Google’s Leanback Library
Android TV: Building apps with Google’s Leanback LibraryJoe Birch
 
Design Patterns for Tablets and Smartphones
Design Patterns for Tablets and SmartphonesDesign Patterns for Tablets and Smartphones
Design Patterns for Tablets and SmartphonesMichael Galpin
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android InfrastructureAlexey Buzdin
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android InfrastructureC.T.Co
 
Embracing the Lollipop
Embracing the LollipopEmbracing the Lollipop
Embracing the LollipopSonja Kesic
 
TechDays 2016 - Developing websites using asp.net core mvc6 and entity framew...
TechDays 2016 - Developing websites using asp.net core mvc6 and entity framew...TechDays 2016 - Developing websites using asp.net core mvc6 and entity framew...
TechDays 2016 - Developing websites using asp.net core mvc6 and entity framew...Fons Sonnemans
 
Volley lab btc_bbit
Volley lab btc_bbitVolley lab btc_bbit
Volley lab btc_bbitCarWash1
 
Getting Started With Material Design
Getting Started With Material DesignGetting Started With Material Design
Getting Started With Material DesignYasin Yildirim
 
Building Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture ComponentsBuilding Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture ComponentsHassan Abid
 
07_UIAndroid.pdf
07_UIAndroid.pdf07_UIAndroid.pdf
07_UIAndroid.pdfImranS18
 
Groovygrailsnetbeans 12517452668498-phpapp03
Groovygrailsnetbeans 12517452668498-phpapp03Groovygrailsnetbeans 12517452668498-phpapp03
Groovygrailsnetbeans 12517452668498-phpapp03Kevin Juma
 
From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)Jose Manuel Pereira Garcia
 

Similar to Material Design and Backwards Compatibility (20)

Android Support Library: Using ActionBarCompat
Android Support Library: Using ActionBarCompatAndroid Support Library: Using ActionBarCompat
Android Support Library: Using ActionBarCompat
 
Android UI Development: Tips, Tricks, and Techniques
Android UI Development: Tips, Tricks, and TechniquesAndroid UI Development: Tips, Tricks, and Techniques
Android UI Development: Tips, Tricks, and Techniques
 
Android UI Tips, Tricks and Techniques
Android UI Tips, Tricks and TechniquesAndroid UI Tips, Tricks and Techniques
Android UI Tips, Tricks and Techniques
 
Android Design Patterns
Android Design PatternsAndroid Design Patterns
Android Design Patterns
 
Android TV: Building apps with Google’s Leanback Library
Android TV: Building apps with  Google’s Leanback LibraryAndroid TV: Building apps with  Google’s Leanback Library
Android TV: Building apps with Google’s Leanback Library
 
Design Patterns for Tablets and Smartphones
Design Patterns for Tablets and SmartphonesDesign Patterns for Tablets and Smartphones
Design Patterns for Tablets and Smartphones
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
 
Embracing the Lollipop
Embracing the LollipopEmbracing the Lollipop
Embracing the Lollipop
 
Android workshop
Android workshopAndroid workshop
Android workshop
 
TechDays 2016 - Developing websites using asp.net core mvc6 and entity framew...
TechDays 2016 - Developing websites using asp.net core mvc6 and entity framew...TechDays 2016 - Developing websites using asp.net core mvc6 and entity framew...
TechDays 2016 - Developing websites using asp.net core mvc6 and entity framew...
 
Modern android development
Modern android developmentModern android development
Modern android development
 
Volley lab btc_bbit
Volley lab btc_bbitVolley lab btc_bbit
Volley lab btc_bbit
 
Getting Started With Material Design
Getting Started With Material DesignGetting Started With Material Design
Getting Started With Material Design
 
Building Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture ComponentsBuilding Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture Components
 
Recyclerview in action
Recyclerview in action Recyclerview in action
Recyclerview in action
 
Android programming basics
Android programming basicsAndroid programming basics
Android programming basics
 
07_UIAndroid.pdf
07_UIAndroid.pdf07_UIAndroid.pdf
07_UIAndroid.pdf
 
Groovygrailsnetbeans 12517452668498-phpapp03
Groovygrailsnetbeans 12517452668498-phpapp03Groovygrailsnetbeans 12517452668498-phpapp03
Groovygrailsnetbeans 12517452668498-phpapp03
 
From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)
 

Recently uploaded

Don't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunity
Don't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunityDon't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunity
Don't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunityApp Ethena
 
Scootsy Overview Deck - Pan City Delivery
Scootsy Overview Deck - Pan City DeliveryScootsy Overview Deck - Pan City Delivery
Scootsy Overview Deck - Pan City Deliveryrishi338139
 
Understanding Post Production changes (PPC) in Clinical Data Management (CDM)...
Understanding Post Production changes (PPC) in Clinical Data Management (CDM)...Understanding Post Production changes (PPC) in Clinical Data Management (CDM)...
Understanding Post Production changes (PPC) in Clinical Data Management (CDM)...soumyapottola
 
GESCO SE Press and Analyst Conference on Financial Results 2024
GESCO SE Press and Analyst Conference on Financial Results 2024GESCO SE Press and Analyst Conference on Financial Results 2024
GESCO SE Press and Analyst Conference on Financial Results 2024GESCO SE
 
Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...
Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...
Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...Sebastiano Panichella
 
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATIONRACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATIONRachelAnnTenibroAmaz
 
Application of GIS in Landslide Disaster Response.pptx
Application of GIS in Landslide Disaster Response.pptxApplication of GIS in Landslide Disaster Response.pptx
Application of GIS in Landslide Disaster Response.pptxRoquia Salam
 
cse-csp batch4 review-1.1.pptx cyber security
cse-csp batch4 review-1.1.pptx cyber securitycse-csp batch4 review-1.1.pptx cyber security
cse-csp batch4 review-1.1.pptx cyber securitysandeepnani2260
 
05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptx
05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptx05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptx
05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptxerickamwana1
 
General Elections Final Press Noteas per M
General Elections Final Press Noteas per MGeneral Elections Final Press Noteas per M
General Elections Final Press Noteas per MVidyaAdsule1
 
INDIAN GCP GUIDELINE. for Regulatory affair 1st sem CRR
INDIAN GCP GUIDELINE. for Regulatory  affair 1st sem CRRINDIAN GCP GUIDELINE. for Regulatory  affair 1st sem CRR
INDIAN GCP GUIDELINE. for Regulatory affair 1st sem CRRsarwankumar4524
 
Sunlight Spectacle 2024 Practical Action Launch Event 2024-04-08
Sunlight Spectacle 2024 Practical Action Launch Event 2024-04-08Sunlight Spectacle 2024 Practical Action Launch Event 2024-04-08
Sunlight Spectacle 2024 Practical Action Launch Event 2024-04-08LloydHelferty
 
Engaging Eid Ul Fitr Presentation for Kindergartners.pptx
Engaging Eid Ul Fitr Presentation for Kindergartners.pptxEngaging Eid Ul Fitr Presentation for Kindergartners.pptx
Engaging Eid Ul Fitr Presentation for Kindergartners.pptxAsifArshad8
 
Testing with Fewer Resources: Toward Adaptive Approaches for Cost-effective ...
Testing with Fewer Resources:  Toward Adaptive Approaches for Cost-effective ...Testing with Fewer Resources:  Toward Adaptive Approaches for Cost-effective ...
Testing with Fewer Resources: Toward Adaptive Approaches for Cost-effective ...Sebastiano Panichella
 

Recently uploaded (14)

Don't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunity
Don't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunityDon't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunity
Don't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunity
 
Scootsy Overview Deck - Pan City Delivery
Scootsy Overview Deck - Pan City DeliveryScootsy Overview Deck - Pan City Delivery
Scootsy Overview Deck - Pan City Delivery
 
Understanding Post Production changes (PPC) in Clinical Data Management (CDM)...
Understanding Post Production changes (PPC) in Clinical Data Management (CDM)...Understanding Post Production changes (PPC) in Clinical Data Management (CDM)...
Understanding Post Production changes (PPC) in Clinical Data Management (CDM)...
 
GESCO SE Press and Analyst Conference on Financial Results 2024
GESCO SE Press and Analyst Conference on Financial Results 2024GESCO SE Press and Analyst Conference on Financial Results 2024
GESCO SE Press and Analyst Conference on Financial Results 2024
 
Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...
Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...
Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...
 
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATIONRACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
 
Application of GIS in Landslide Disaster Response.pptx
Application of GIS in Landslide Disaster Response.pptxApplication of GIS in Landslide Disaster Response.pptx
Application of GIS in Landslide Disaster Response.pptx
 
cse-csp batch4 review-1.1.pptx cyber security
cse-csp batch4 review-1.1.pptx cyber securitycse-csp batch4 review-1.1.pptx cyber security
cse-csp batch4 review-1.1.pptx cyber security
 
05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptx
05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptx05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptx
05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptx
 
General Elections Final Press Noteas per M
General Elections Final Press Noteas per MGeneral Elections Final Press Noteas per M
General Elections Final Press Noteas per M
 
INDIAN GCP GUIDELINE. for Regulatory affair 1st sem CRR
INDIAN GCP GUIDELINE. for Regulatory  affair 1st sem CRRINDIAN GCP GUIDELINE. for Regulatory  affair 1st sem CRR
INDIAN GCP GUIDELINE. for Regulatory affair 1st sem CRR
 
Sunlight Spectacle 2024 Practical Action Launch Event 2024-04-08
Sunlight Spectacle 2024 Practical Action Launch Event 2024-04-08Sunlight Spectacle 2024 Practical Action Launch Event 2024-04-08
Sunlight Spectacle 2024 Practical Action Launch Event 2024-04-08
 
Engaging Eid Ul Fitr Presentation for Kindergartners.pptx
Engaging Eid Ul Fitr Presentation for Kindergartners.pptxEngaging Eid Ul Fitr Presentation for Kindergartners.pptx
Engaging Eid Ul Fitr Presentation for Kindergartners.pptx
 
Testing with Fewer Resources: Toward Adaptive Approaches for Cost-effective ...
Testing with Fewer Resources:  Toward Adaptive Approaches for Cost-effective ...Testing with Fewer Resources:  Toward Adaptive Approaches for Cost-effective ...
Testing with Fewer Resources: Toward Adaptive Approaches for Cost-effective ...
 

Material Design and Backwards Compatibility

  • 2. 2 About Me • Mobile Development • Android • iOS • REST-Api Design • Cloud Infrastructure +Angelo Rüggeberg @s3xy4ngyc http://s3xy4ngyc.github.io
  • 3. Sample app • Source Available at Github: https://github.com/ s3xy4ngyc/Android-L-Samples • Available at Google Play: https://play.google.com/ store/apps/details? id=s3xy.de.lsamples 3
  • 4. 4
  • 7. Distribution • Devices having Android 5.0 officially: • Nexus 5 • Nexus 7 • Nexus 9 • LG G3 6
  • 11. 9
  • 12. 9 dependencies { compile 'com.android.support:support-v4:21.0.2' compile 'com.android.support:appcompat-v7:21.0.2' compile 'com.android.support:cardview-v7:21.0.2' compile 'com.android.support:recyclerview-v7:21.0.2' compile 'com.android.support:gridlayout-v7:21.0.2' compile 'com.android.support:mediarouter-v7:21.0.2' compile 'com.android.support:palette-v7:21.0.2' compile 'com.android.support:support-v13:21.0.2' compile 'com.android.support:leanback-v17:21.0.2' compile 'com.android.support:support-annotations:21.0.2' }
  • 13. 9 dependencies { compile 'com.android.support:support-v4:21.0.2' compile 'com.android.support:appcompat-v7:21.0.2' compile 'com.android.support:cardview-v7:21.0.2' compile 'com.android.support:recyclerview-v7:21.0.2' compile 'com.android.support:gridlayout-v7:21.0.2' compile 'com.android.support:mediarouter-v7:21.0.2' compile 'com.android.support:palette-v7:21.0.2' compile 'com.android.support:support-v13:21.0.2' compile 'com.android.support:leanback-v17:21.0.2' compile 'com.android.support:support-annotations:21.0.2' } ‚//material Theme, ActionBar, etc.
  • 14. 9 dependencies { compile 'com.android.support:support-v4:21.0.2' compile 'com.android.support:appcompat-v7:21.0.2' compile 'com.android.support:cardview-v7:21.0.2' compile 'com.android.support:recyclerview-v7:21.0.2' compile 'com.android.support:gridlayout-v7:21.0.2' compile 'com.android.support:mediarouter-v7:21.0.2' compile 'com.android.support:palette-v7:21.0.2' compile 'com.android.support:support-v13:21.0.2' compile 'com.android.support:leanback-v17:21.0.2' compile 'com.android.support:support-annotations:21.0.2' } ‚//material Theme, ActionBar, etc. ‚//New Components for Pre 5.0
  • 16. 11
  • 18. 11 android: Theme.Material android: Theme.Material.Light
  • 19. Theme.AppCompat Theme.AppCompat.Light 11 android: Theme.Material android: Theme.Material.Light
  • 21. Apply Material Theme • Custom Style Extending Appcompat Style 12
  • 22. Apply Material Theme • Custom Style Extending Appcompat Style • Things to note: 12
  • 23. Apply Material Theme • Custom Style Extending Appcompat Style • Things to note: • No more @android duplicates 12
  • 24. Apply Material Theme • Custom Style Extending Appcompat Style • Things to note: • No more @android duplicates • No more v14+ Style Folder 12
  • 25. 13
  • 26. 13
  • 27. 13
  • 28. 13
  • 29. 13
  • 30. 13
  • 31. 13
  • 33. Apply Material Theme • Ui Elements that Get Material Design: • EditText • Spinner • CheckBox • RadioButton • Switch • CheckedTextView 14
  • 34. Apply Material Theme • Ui Elements that Get Material Design: • EditText • Spinner • CheckBox • RadioButton • Switch • CheckedTextView • All Other UI Elements do not get Styled and Need Custom Styling/Views 14
  • 35. Action Bar Drawer Toggle 15
  • 36. 16 Action Bar Drawer Toggle
  • 37. 16 Action Bar Drawer Toggle
  • 38. Action Bar Drawer Toggle 17
  • 39. Action Bar Drawer Toggle • import android.support.v7.app.ActionBarDrawerT oggle • Extend from ActionBarActivity • Init DrawerToggle with Drawer Layout • Assign DrawerToggle to DrawerLayout 17
  • 40. 18
  • 41. 18 DrawerLayout mDrawerLayout; ActionBarDrawerToggle drawerToggle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); drawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.app_name, R.string.app_name) { }; mDrawerLayout.setDrawerListener(drawerToggle); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); }
  • 42. 18 DrawerLayout mDrawerLayout; ActionBarDrawerToggle drawerToggle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); drawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.app_name, R.string.app_name) { }; mDrawerLayout.setDrawerListener(drawerToggle); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); }
  • 43. 18 DrawerLayout mDrawerLayout; ActionBarDrawerToggle drawerToggle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); drawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.app_name, R.string.app_name) { }; mDrawerLayout.setDrawerListener(drawerToggle); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); }
  • 44. 18 DrawerLayout mDrawerLayout; ActionBarDrawerToggle drawerToggle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); drawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.app_name, R.string.app_name) { }; mDrawerLayout.setDrawerListener(drawerToggle); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); }
  • 45. 18 DrawerLayout mDrawerLayout; ActionBarDrawerToggle drawerToggle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); drawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.app_name, R.string.app_name) { }; mDrawerLayout.setDrawerListener(drawerToggle); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); }
  • 48. Card View • Support for rounded Corners • Elevation Shadows 20
  • 49. Card View • Support for rounded Corners • Elevation Shadows • Limitations: • On Pre-L no Clipping for Children with Round Corners • On Pre-L Adds Padding to Draw Shadows 20
  • 50. 21
  • 51. 22
  • 52. 22 <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/cardView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="5dp" android:background="?android:selectableItemBackground" app:cardCornerRadius="2dp" app:cardElevation="5dp" app:cardPreventCornerOverlap="true" app:cardUseCompatPadding="true"> <!-- Place Your Textviews etc. in here --> <LinearLayout...> </android.support.v7.widget.CardView>
  • 55. Recycler View • „Replacement“ for ListView • Implements the ViewHolderPattern • Improved Recycling • LayoutManager • Vertical List View • Horizontal List View • Staggered Grid View 24
  • 56. 25
  • 61. 26
  • 62. 27 Recycler View - Adapter
  • 63. 27 Recycler View - Adapter Old Adapter: class MenuAdapterOld extends ArrayAdapter<String> {
  • 64. 27 Recycler View - Adapter Old Adapter: class MenuAdapterOld extends ArrayAdapter<String> { New Adapter: import android.support.v7.widget.RecyclerView; public class MenuAdapter extends RecyclerView.Adapter<MenuAdapter.ViewHolder> {
  • 65. 28 Recycler View - Adapter
  • 66. 28 private ArrayList<String> mDataset; private OnItemClickListener mListener; public MenuAdapter(ArrayList<String> myDataset, OnItemClickListener listener) { mDataset = myDataset; mListener = listener; } Recycler View - Adapter
  • 67. 29 Recycler View - Adapter
  • 68. 29 private ArrayList<String> mDataset; private OnItemClickListener mListener; public MenuAdapter(ArrayList<String> myDataset, OnItemClickListener listener) { mDataset = myDataset; mListener = listener; } Recycler View - Adapter
  • 69. 29 private ArrayList<String> mDataset; private OnItemClickListener mListener; public MenuAdapter(ArrayList<String> myDataset, OnItemClickListener listener) { mDataset = myDataset; mListener = listener; } Recycler View - Adapter
  • 70. 29 private ArrayList<String> mDataset; private OnItemClickListener mListener; public MenuAdapter(ArrayList<String> myDataset, OnItemClickListener listener) { mDataset = myDataset; mListener = listener; } Recycler View - Adapter @Override public int getItemCount() { return mDataset.size(); }
  • 71. 30 Recycler View - Adapter
  • 72. 30 public static class ViewHolder extends RecyclerView.ViewHolder { ImageView mPhoto; TextView mPhotoTitle; CardView mCardView; public ViewHolder(View itemView) { super(itemView); mPhoto = (ImageView) itemView.findViewById(R.id.photo); mPhotoTitle = (TextView) itemView.findViewById(R.id.photoTitle); mCardView = (CardView) itemView.findViewById(R.id.cardView); } } Recycler View - Adapter
  • 73. 30 public static class ViewHolder extends RecyclerView.ViewHolder { ImageView mPhoto; TextView mPhotoTitle; CardView mCardView; public ViewHolder(View itemView) { super(itemView); mPhoto = (ImageView) itemView.findViewById(R.id.photo); mPhotoTitle = (TextView) itemView.findViewById(R.id.photoTitle); mCardView = (CardView) itemView.findViewById(R.id.cardView); } } Recycler View - Adapter
  • 74. 30 public static class ViewHolder extends RecyclerView.ViewHolder { ImageView mPhoto; TextView mPhotoTitle; CardView mCardView; public ViewHolder(View itemView) { super(itemView); mPhoto = (ImageView) itemView.findViewById(R.id.photo); mPhotoTitle = (TextView) itemView.findViewById(R.id.photoTitle); mCardView = (CardView) itemView.findViewById(R.id.cardView); } } Recycler View - Adapter
  • 75. 30 public static class ViewHolder extends RecyclerView.ViewHolder { ImageView mPhoto; TextView mPhotoTitle; CardView mCardView; public ViewHolder(View itemView) { super(itemView); mPhoto = (ImageView) itemView.findViewById(R.id.photo); mPhotoTitle = (TextView) itemView.findViewById(R.id.photoTitle); mCardView = (CardView) itemView.findViewById(R.id.cardView); } } Recycler View - Adapter
  • 76. 30 public static class ViewHolder extends RecyclerView.ViewHolder { ImageView mPhoto; TextView mPhotoTitle; CardView mCardView; public ViewHolder(View itemView) { super(itemView); mPhoto = (ImageView) itemView.findViewById(R.id.photo); mPhotoTitle = (TextView) itemView.findViewById(R.id.photoTitle); mCardView = (CardView) itemView.findViewById(R.id.cardView); } } Recycler View - Adapter
  • 77. 31 Recycler View - Adapter
  • 78. 31 @Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View v = LayoutInflater.from(viewGroup.getContext()).inflate(rowLayout, viewGroup, false); return new ViewHolder(v); } @Override public void onBindViewHolder(final ViewHolder viewHolder, final int i) { Photo p = photos.get(i); mPicasso.load(p.getUrl()).error(android.R.drawable.stat_notify_error).placeholder(android.R. drawable.stat_notify_sync).into(viewHolder.mPhoto); viewHolder.mPhotoTitle.setText(p.getId()); if (viewHolder.mPhotographerTitle != null) { viewHolder.mPhotographerTitle.setText(p.getTitle()); } viewHolder.mCardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mListener.onClick(viewHolder.mPhoto, i); } }); } Recycler View - Adapter
  • 79. 31 @Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View v = LayoutInflater.from(viewGroup.getContext()).inflate(rowLayout, viewGroup, false); return new ViewHolder(v); } @Override public void onBindViewHolder(final ViewHolder viewHolder, final int i) { Photo p = photos.get(i); mPicasso.load(p.getUrl()).error(android.R.drawable.stat_notify_error).placeholder(android.R. drawable.stat_notify_sync).into(viewHolder.mPhoto); viewHolder.mPhotoTitle.setText(p.getId()); if (viewHolder.mPhotographerTitle != null) { viewHolder.mPhotographerTitle.setText(p.getTitle()); } viewHolder.mCardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mListener.onClick(viewHolder.mPhoto, i); } }); } Recycler View - Adapter
  • 80. 31 @Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View v = LayoutInflater.from(viewGroup.getContext()).inflate(rowLayout, viewGroup, false); return new ViewHolder(v); } @Override public void onBindViewHolder(final ViewHolder viewHolder, final int i) { Photo p = photos.get(i); mPicasso.load(p.getUrl()).error(android.R.drawable.stat_notify_error).placeholder(android.R. drawable.stat_notify_sync).into(viewHolder.mPhoto); viewHolder.mPhotoTitle.setText(p.getId()); if (viewHolder.mPhotographerTitle != null) { viewHolder.mPhotographerTitle.setText(p.getTitle()); } viewHolder.mCardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mListener.onClick(viewHolder.mPhoto, i); } }); } Recycler View - Adapter
  • 81. 31 @Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View v = LayoutInflater.from(viewGroup.getContext()).inflate(rowLayout, viewGroup, false); return new ViewHolder(v); } @Override public void onBindViewHolder(final ViewHolder viewHolder, final int i) { Photo p = photos.get(i); mPicasso.load(p.getUrl()).error(android.R.drawable.stat_notify_error).placeholder(android.R. drawable.stat_notify_sync).into(viewHolder.mPhoto); viewHolder.mPhotoTitle.setText(p.getId()); if (viewHolder.mPhotographerTitle != null) { viewHolder.mPhotographerTitle.setText(p.getTitle()); } viewHolder.mCardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mListener.onClick(viewHolder.mPhoto, i); } }); } Recycler View - Adapter
  • 82. 31 @Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View v = LayoutInflater.from(viewGroup.getContext()).inflate(rowLayout, viewGroup, false); return new ViewHolder(v); } @Override public void onBindViewHolder(final ViewHolder viewHolder, final int i) { Photo p = photos.get(i); mPicasso.load(p.getUrl()).error(android.R.drawable.stat_notify_error).placeholder(android.R. drawable.stat_notify_sync).into(viewHolder.mPhoto); viewHolder.mPhotoTitle.setText(p.getId()); if (viewHolder.mPhotographerTitle != null) { viewHolder.mPhotographerTitle.setText(p.getTitle()); } viewHolder.mCardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mListener.onClick(viewHolder.mPhoto, i); } }); } Recycler View - Adapter
  • 83. 32
  • 84. 32 • Linear Layout Manager
  • 85. 32 • Linear Layout Manager • Supports Smooth Scrolling
  • 86. 32 • Linear Layout Manager • Supports Smooth Scrolling
  • 87. 33
  • 88. 33 • Linear Layout Manager
  • 89. 33 • Linear Layout Manager • Orientation Horizontal
  • 90. 33 • Linear Layout Manager • Orientation Horizontal
  • 91. 34
  • 92. 34 • Staggered Grid Layout Manager
  • 93. 34 • Staggered Grid Layout Manager • Grid Size can be defined
  • 94. 34 • Staggered Grid Layout Manager • Grid Size can be defined • Supports Vertical and Horizontal Scrolling
  • 95. 34 • Staggered Grid Layout Manager • Grid Size can be defined • Supports Vertical and Horizontal Scrolling
  • 97.
  • 99. Toolbar • ActionBar == Toolbar • Toolbar is a ViewGroup • Styleable • Positionable 37
  • 104. Limitations • Activity Transitions are Possible, BUT won’t be applied on PRE 5.0 Devices • Many „New“ Ui Elements are not available in the API, thus require separate Implementation/Style. 41
  • 106. Limitations • Elements not Included: • Fancy Material Progressbars • Buttons • Flat • Raised • Round / Floating • Sliders • Snackbars 42
  • 108. Limitations • Things not Supported on Pre 5.0: • Activity transitions • Touch feedback • Reveal animations • Path-based animations • Vector drawables • Drawable tinting 43
  • 110. Useful Links • Official Documentation: http://developer.android.com/tools/ support-library/index.html • Index for Open Source Libraries: https://android-arsenal.com/ • e.G. Missing Ui Elements 45
  • 111.
  • 112. Questions? AngeloRüggeberg twitter.com/ s3xy4ngyc google.com/+ s3xy4ngyc .github.io github.com/ s3xy4ngyc