SlideShare ist ein Scribd-Unternehmen logo
1 von 14
Introdução ao
RecyclerView
Desenvolvedor Mobile
Meu apps pessoais
https://goo.gl/sVpNU7https://goo.gl/Y7D9X
Surgiu no Android Lollipop junto com o Material Design.
w. Tem como objetivo reaproveitar as views, ele recicla e impleme
Vantagens
• Suporte a animações ao adicionar e remover itens da
lista;
• Controle automático da reutilização das views;
• Permitir alterar o gerenciador de layout para rendereizar
as views como listas, grids, etc.
compile ‘com.android.support:recyclerview-v7:23.1.0’
<android.support.v7.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
/res/layout/activity_recycler.xml
public class RecyclerActivity extends Activity {
RecyclerView mRecyclerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_recycler);
mRecyclerView = (RecyclerView) findViewById(R.id.recyclerview);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRecyclerView.setAdapter(new BasicListAdapter(this));
}
}
erics, com isso os métodos onCreateViewHolder() e onBindVie
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> {
private Context context;
private List<Object> list;
public onCreateViewHolder(Context context, List<Object> list) {…}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
//Cria uma subclasse de RecyclerView.ViewHolder
View view = LayoutInflater.from(context).inflate(R.layout.my_adapter, viewGroup, false);
MyViewHolder holder = new MyViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(final MyViewHolder holder, final int position) {
//Receber o índice do elemento e atualiza as views que estão
//dentro do ViewHolder
}
}
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> {
//onCreateViewHolder() e onBindViewHolder()
public static class MyViewHolder extends RecyclerView.ViewHolder {
public MyViewHolder(View view) {
//Implementação….
}
}
}
O RecyclerView provê
maior controle sobre os
itens na tela
@Override
public void onBindViewHolder(final MyViewHolder holder, final int position) {
String name = list.get(position);
textViewNome.setText(mDataset.get(position));
textViewNome.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
remove(name);
}
});
}
Obrigado
@RodrigoAmora
rodrigo.amora.freitas@gmail.com

Weitere ähnliche Inhalte

Andere mochten auch

The State of the Compensation Practice
The State of the Compensation PracticeThe State of the Compensation Practice
The State of the Compensation PracticeLance Berger
 
Presentasi Tianshi Unicore
Presentasi  Tianshi UnicorePresentasi  Tianshi Unicore
Presentasi Tianshi UnicoreGunawan Cen
 
Usporedba alata canva i smore
Usporedba alata canva i smoreUsporedba alata canva i smore
Usporedba alata canva i smoreIvan Rupčić
 
Erroma
ErromaErroma
ErromaJonKas
 
Inundaciones
InundacionesInundaciones
Inundacionestropeda
 
El feudalisme 1
El feudalisme 1El feudalisme 1
El feudalisme 1Sílvia
 
Vocabulario - Médicos 2 - Instrumentos
Vocabulario - Médicos 2 - InstrumentosVocabulario - Médicos 2 - Instrumentos
Vocabulario - Médicos 2 - InstrumentosGustavo Balcazar
 
Progressive Web App
Progressive Web AppProgressive Web App
Progressive Web AppSubodh Garg
 

Andere mochten auch (14)

Ruta morisca a Millars.
Ruta morisca a Millars.Ruta morisca a Millars.
Ruta morisca a Millars.
 
The State of the Compensation Practice
The State of the Compensation PracticeThe State of the Compensation Practice
The State of the Compensation Practice
 
Presentasi Tianshi Unicore
Presentasi  Tianshi UnicorePresentasi  Tianshi Unicore
Presentasi Tianshi Unicore
 
A economia da gratuitidade
A economia da gratuitidadeA economia da gratuitidade
A economia da gratuitidade
 
Sistema respiratorio
Sistema respiratorioSistema respiratorio
Sistema respiratorio
 
Lesson Plan - Reading
Lesson Plan - ReadingLesson Plan - Reading
Lesson Plan - Reading
 
Usporedba alata canva i smore
Usporedba alata canva i smoreUsporedba alata canva i smore
Usporedba alata canva i smore
 
Reeducação Emocional
Reeducação  EmocionalReeducação  Emocional
Reeducação Emocional
 
Erroma
ErromaErroma
Erroma
 
El iglu
El iglu El iglu
El iglu
 
Inundaciones
InundacionesInundaciones
Inundaciones
 
El feudalisme 1
El feudalisme 1El feudalisme 1
El feudalisme 1
 
Vocabulario - Médicos 2 - Instrumentos
Vocabulario - Médicos 2 - InstrumentosVocabulario - Médicos 2 - Instrumentos
Vocabulario - Médicos 2 - Instrumentos
 
Progressive Web App
Progressive Web AppProgressive Web App
Progressive Web App
 

Ähnlich wie Introdução ao RecyclerView

Material Design (The Technical Essentials) by Mohammad Aljobairi @AMMxDROID
Material Design (The Technical Essentials) by Mohammad Aljobairi @AMMxDROIDMaterial Design (The Technical Essentials) by Mohammad Aljobairi @AMMxDROID
Material Design (The Technical Essentials) by Mohammad Aljobairi @AMMxDROIDJordan Open Source Association
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android AppsGil Irizarry
 
Native Android Development Practices
Native Android Development PracticesNative Android Development Practices
Native Android Development PracticesRoy Clarkson
 
Volley lab btc_bbit
Volley lab btc_bbitVolley lab btc_bbit
Volley lab btc_bbitCarWash1
 
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?Brenda Cook
 
How to use data binding in android
How to use data binding in androidHow to use data binding in android
How to use data binding in androidInnovationM
 
Android apps development
Android apps developmentAndroid apps development
Android apps developmentMonir Zzaman
 
Android Workshop
Android WorkshopAndroid Workshop
Android WorkshopJunda Ong
 
Android chapter25-map views
Android chapter25-map viewsAndroid chapter25-map views
Android chapter25-map viewsTran Le Hoan
 
Android Apps Development Basic
Android Apps Development BasicAndroid Apps Development Basic
Android Apps Development BasicMonir Zzaman
 
Android app development basics
Android app development basicsAndroid app development basics
Android app development basicsAnton Narusberg
 
User experience and interactions design
User experience and interactions design User experience and interactions design
User experience and interactions design Rakesh Jha
 
Building a dashboard using AngularJS
Building a dashboard using AngularJSBuilding a dashboard using AngularJS
Building a dashboard using AngularJSRajthilakMCA
 
07_UIAndroid.pdf
07_UIAndroid.pdf07_UIAndroid.pdf
07_UIAndroid.pdfImranS18
 
Desenvolver para Chromecast
Desenvolver para ChromecastDesenvolver para Chromecast
Desenvolver para ChromecastPedro Veloso
 
Little Opinions, Big Possibilities: The Tools and Patterns for Building Larg...
 Little Opinions, Big Possibilities: The Tools and Patterns for Building Larg... Little Opinions, Big Possibilities: The Tools and Patterns for Building Larg...
Little Opinions, Big Possibilities: The Tools and Patterns for Building Larg...Brian Mann
 
Maps in android
Maps in androidMaps in android
Maps in androidSumita Das
 
android layouts
android layoutsandroid layouts
android layoutsDeepa Rani
 

Ähnlich wie Introdução ao RecyclerView (20)

Material Design (The Technical Essentials) by Mohammad Aljobairi @AMMxDROID
Material Design (The Technical Essentials) by Mohammad Aljobairi @AMMxDROIDMaterial Design (The Technical Essentials) by Mohammad Aljobairi @AMMxDROID
Material Design (The Technical Essentials) by Mohammad Aljobairi @AMMxDROID
 
Android Materials Design
Android Materials Design Android Materials Design
Android Materials Design
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android Apps
 
Native Android Development Practices
Native Android Development PracticesNative Android Development Practices
Native Android Development Practices
 
Volley lab btc_bbit
Volley lab btc_bbitVolley lab btc_bbit
Volley lab btc_bbit
 
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?
 
How to use data binding in android
How to use data binding in androidHow to use data binding in android
How to use data binding in android
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
 
Android Workshop
Android WorkshopAndroid Workshop
Android Workshop
 
Android chapter25-map views
Android chapter25-map viewsAndroid chapter25-map views
Android chapter25-map views
 
Android programming basics
Android programming basicsAndroid programming basics
Android programming basics
 
Android Apps Development Basic
Android Apps Development BasicAndroid Apps Development Basic
Android Apps Development Basic
 
Android app development basics
Android app development basicsAndroid app development basics
Android app development basics
 
User experience and interactions design
User experience and interactions design User experience and interactions design
User experience and interactions design
 
Building a dashboard using AngularJS
Building a dashboard using AngularJSBuilding a dashboard using AngularJS
Building a dashboard using AngularJS
 
07_UIAndroid.pdf
07_UIAndroid.pdf07_UIAndroid.pdf
07_UIAndroid.pdf
 
Desenvolver para Chromecast
Desenvolver para ChromecastDesenvolver para Chromecast
Desenvolver para Chromecast
 
Little Opinions, Big Possibilities: The Tools and Patterns for Building Larg...
 Little Opinions, Big Possibilities: The Tools and Patterns for Building Larg... Little Opinions, Big Possibilities: The Tools and Patterns for Building Larg...
Little Opinions, Big Possibilities: The Tools and Patterns for Building Larg...
 
Maps in android
Maps in androidMaps in android
Maps in android
 
android layouts
android layoutsandroid layouts
android layouts
 

Kürzlich hochgeladen

Android Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesAndroid Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesChandrakantDivate1
 
Mobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s ToolsMobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s ToolsChandrakantDivate1
 
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...nishasame66
 
Mobile Application Development-Components and Layouts
Mobile Application Development-Components and LayoutsMobile Application Development-Components and Layouts
Mobile Application Development-Components and LayoutsChandrakantDivate1
 
Mobile App Penetration Testing Bsides312
Mobile App Penetration Testing Bsides312Mobile App Penetration Testing Bsides312
Mobile App Penetration Testing Bsides312wphillips114
 

Kürzlich hochgeladen (6)

Android Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesAndroid Application Components with Implementation & Examples
Android Application Components with Implementation & Examples
 
Mobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s ToolsMobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s Tools
 
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
 
Mobile Application Development-Components and Layouts
Mobile Application Development-Components and LayoutsMobile Application Development-Components and Layouts
Mobile Application Development-Components and Layouts
 
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
 
Mobile App Penetration Testing Bsides312
Mobile App Penetration Testing Bsides312Mobile App Penetration Testing Bsides312
Mobile App Penetration Testing Bsides312
 

Introdução ao RecyclerView