SlideShare a Scribd company logo
Build UI With
Xamarin.Android
A L B I L A G A L I N G G R A P R A D A N A
R A D Y A L A B S
A L B I L A G A @ R A D Y A L A B S . C O M
@ A L B I L A G A
Xamarin.Android
Xamarin.Android allows us to create native Android applications using the same UI controls we
would in Java, except with the flexibility and elegance of a modern language (C#), the power of
the .NET Base Class Library (BCL)
Activity & Navigation
Activity & Navigation (2)
Sample Code Navigation
Activity & Navigation (Demo)
List View & Adapter
List View vs Recycler View
1. View Holders
2. Layout Manager
3. Item Animator
4. Adapter
5. Item Decoration
6. OnItemTouchListener
Sample Code Recycler View
Sample Code Recycler View Adapter
Recycler View Result
List View & Adapter (Demo)

More Related Content

What's hot

Xamarin.Forms - Your Complete Mobile Solution
Xamarin.Forms - Your Complete Mobile SolutionXamarin.Forms - Your Complete Mobile Solution
Xamarin.Forms - Your Complete Mobile Solution
Commit University
 
An Inforgraphic to Learn React Native
An Inforgraphic to Learn React NativeAn Inforgraphic to Learn React Native
An Inforgraphic to Learn React Native
Paddy Lock
 
Making Apps More Human - Intro to Microsoft Cognitive Services
Making Apps More Human - Intro to Microsoft Cognitive ServicesMaking Apps More Human - Intro to Microsoft Cognitive Services
Making Apps More Human - Intro to Microsoft Cognitive Services
Matthew Soucoup
 
Xamarin y MS Azure | Cognitive Services
Xamarin y MS Azure | Cognitive ServicesXamarin y MS Azure | Cognitive Services
Xamarin y MS Azure | Cognitive Services
Vicente Gerardo Guzman Lucio
 
Reactive web applications using MeteorJS
Reactive web applications using MeteorJSReactive web applications using MeteorJS
Reactive web applications using MeteorJS
NodeXperts
 
Native iOS and Android Development with Xamarin
Native iOS and Android Development with XamarinNative iOS and Android Development with Xamarin
Native iOS and Android Development with Xamarin
James Montemagno
 
Xamarin 0
Xamarin 0Xamarin 0
Xamarin 0
Fajar Baskoro
 
Application Programming Interface Implementation For Building Software Applic...
Application Programming Interface Implementation For Building Software Applic...Application Programming Interface Implementation For Building Software Applic...
Application Programming Interface Implementation For Building Software Applic...
SlideTeam
 
Restful api modeling language
Restful api modeling languageRestful api modeling language
Restful api modeling language
Prabhat gangwar
 
Xamarin cross platform
Xamarin cross platformXamarin cross platform
Xamarin cross platform
Guada Casuso
 
Native i os, android, and windows development in c# with xamarin 4
Native i os, android, and windows development in c# with xamarin 4Native i os, android, and windows development in c# with xamarin 4
Native i os, android, and windows development in c# with xamarin 4
Xamarin
 
Cloud-enabling iOS & Android apps with C# (using Xamarin)
Cloud-enabling iOS & Android apps with C# (using Xamarin)Cloud-enabling iOS & Android apps with C# (using Xamarin)
Cloud-enabling iOS & Android apps with C# (using Xamarin)
Craig Dunn
 
Introduction to xamarin.forms
Introduction to xamarin.formsIntroduction to xamarin.forms
Introduction to xamarin.forms
Abhishek Kumar Gupta
 
API Design Approach
API Design ApproachAPI Design Approach
API Design Approach
Adrian Gigante
 
Cross Platform Development with Xamarin
Cross Platform Development with XamarinCross Platform Development with Xamarin
Cross Platform Development with Xamarin
bryan costanich
 
Intro to AI and CoreML in Swift: Hear + Now 2019
Intro to AI and CoreML in Swift: Hear + Now 2019Intro to AI and CoreML in Swift: Hear + Now 2019
Intro to AI and CoreML in Swift: Hear + Now 2019
Elizabeth (Lizzie) Siegle
 
Xamarin overview droidcon.tn
Xamarin overview   droidcon.tnXamarin overview   droidcon.tn
Xamarin overview droidcon.tn
Houssem Dellai
 

What's hot (17)

Xamarin.Forms - Your Complete Mobile Solution
Xamarin.Forms - Your Complete Mobile SolutionXamarin.Forms - Your Complete Mobile Solution
Xamarin.Forms - Your Complete Mobile Solution
 
An Inforgraphic to Learn React Native
An Inforgraphic to Learn React NativeAn Inforgraphic to Learn React Native
An Inforgraphic to Learn React Native
 
Making Apps More Human - Intro to Microsoft Cognitive Services
Making Apps More Human - Intro to Microsoft Cognitive ServicesMaking Apps More Human - Intro to Microsoft Cognitive Services
Making Apps More Human - Intro to Microsoft Cognitive Services
 
Xamarin y MS Azure | Cognitive Services
Xamarin y MS Azure | Cognitive ServicesXamarin y MS Azure | Cognitive Services
Xamarin y MS Azure | Cognitive Services
 
Reactive web applications using MeteorJS
Reactive web applications using MeteorJSReactive web applications using MeteorJS
Reactive web applications using MeteorJS
 
Native iOS and Android Development with Xamarin
Native iOS and Android Development with XamarinNative iOS and Android Development with Xamarin
Native iOS and Android Development with Xamarin
 
Xamarin 0
Xamarin 0Xamarin 0
Xamarin 0
 
Application Programming Interface Implementation For Building Software Applic...
Application Programming Interface Implementation For Building Software Applic...Application Programming Interface Implementation For Building Software Applic...
Application Programming Interface Implementation For Building Software Applic...
 
Restful api modeling language
Restful api modeling languageRestful api modeling language
Restful api modeling language
 
Xamarin cross platform
Xamarin cross platformXamarin cross platform
Xamarin cross platform
 
Native i os, android, and windows development in c# with xamarin 4
Native i os, android, and windows development in c# with xamarin 4Native i os, android, and windows development in c# with xamarin 4
Native i os, android, and windows development in c# with xamarin 4
 
Cloud-enabling iOS & Android apps with C# (using Xamarin)
Cloud-enabling iOS & Android apps with C# (using Xamarin)Cloud-enabling iOS & Android apps with C# (using Xamarin)
Cloud-enabling iOS & Android apps with C# (using Xamarin)
 
Introduction to xamarin.forms
Introduction to xamarin.formsIntroduction to xamarin.forms
Introduction to xamarin.forms
 
API Design Approach
API Design ApproachAPI Design Approach
API Design Approach
 
Cross Platform Development with Xamarin
Cross Platform Development with XamarinCross Platform Development with Xamarin
Cross Platform Development with Xamarin
 
Intro to AI and CoreML in Swift: Hear + Now 2019
Intro to AI and CoreML in Swift: Hear + Now 2019Intro to AI and CoreML in Swift: Hear + Now 2019
Intro to AI and CoreML in Swift: Hear + Now 2019
 
Xamarin overview droidcon.tn
Xamarin overview   droidcon.tnXamarin overview   droidcon.tn
Xamarin overview droidcon.tn
 

More from Albilaga Linggra Pradana

Advanced xamarin development
Advanced xamarin developmentAdvanced xamarin development
Advanced xamarin development
Albilaga Linggra Pradana
 
Chatbot Development Using Bot Framework and Xamarin
Chatbot Development Using Bot Framework and XamarinChatbot Development Using Bot Framework and Xamarin
Chatbot Development Using Bot Framework and Xamarin
Albilaga Linggra Pradana
 
Pembangung aplikasi cross platform pelacak kendaraan dengan metode portable c...
Pembangung aplikasi cross platform pelacak kendaraan dengan metode portable c...Pembangung aplikasi cross platform pelacak kendaraan dengan metode portable c...
Pembangung aplikasi cross platform pelacak kendaraan dengan metode portable c...
Albilaga Linggra Pradana
 
Connect Xamarin.Android to Web Services
Connect Xamarin.Android to Web ServicesConnect Xamarin.Android to Web Services
Connect Xamarin.Android to Web Services
Albilaga Linggra Pradana
 
Introduction to Xamarin
Introduction to XamarinIntroduction to Xamarin
Introduction to Xamarin
Albilaga Linggra Pradana
 
Azure Mobile Service On Android
Azure Mobile Service On AndroidAzure Mobile Service On Android
Azure Mobile Service On Android
Albilaga Linggra Pradana
 

More from Albilaga Linggra Pradana (6)

Advanced xamarin development
Advanced xamarin developmentAdvanced xamarin development
Advanced xamarin development
 
Chatbot Development Using Bot Framework and Xamarin
Chatbot Development Using Bot Framework and XamarinChatbot Development Using Bot Framework and Xamarin
Chatbot Development Using Bot Framework and Xamarin
 
Pembangung aplikasi cross platform pelacak kendaraan dengan metode portable c...
Pembangung aplikasi cross platform pelacak kendaraan dengan metode portable c...Pembangung aplikasi cross platform pelacak kendaraan dengan metode portable c...
Pembangung aplikasi cross platform pelacak kendaraan dengan metode portable c...
 
Connect Xamarin.Android to Web Services
Connect Xamarin.Android to Web ServicesConnect Xamarin.Android to Web Services
Connect Xamarin.Android to Web Services
 
Introduction to Xamarin
Introduction to XamarinIntroduction to Xamarin
Introduction to Xamarin
 
Azure Mobile Service On Android
Azure Mobile Service On AndroidAzure Mobile Service On Android
Azure Mobile Service On Android
 

Build UI with Xamarin.Android

Editor's Notes

  1. Android Tutorials Expo Navigator Shop  About Us Contact Us Home » Android » Android RecyclerView vs ListView | Comparison Android RecyclerView vs ListView | Comparison 2 Mar, 2015  in Android  tagged Material Design / Material Design Backward Compatibility by Mohit Gupt (updated on March 7, 2015) Android is an evolving platform. Recently 5.0 (Lollipop) version of Android was released, along with the official RecyclerView support v7 library. As per the official documentation RecyclerView is a major enhancement over ListView. It contains many new features like ViewHolder, ItemDecorator, LayoutManager, and SmoothScroller. But one thing that certainly gives it an edge over the ListView is; the ability to have animations while adding or removing an item. Here in Android RecyclerView vs ListView sum up I would compare the various features of RecyclerView and ListView and form an opinion why it should be used in new implementations. In this article I will not discuss on how to implement a RecyclerView. Although If you wish to know about the implementation of it, please refer to Android RecyclerView Example. Differences Between RecyclerView and ListView 1. View Holders In ListView, defining view holders was a suggested approach for keeping references for views. But it was not a compulsion. Although by not doing so, ListView used show stale data. Another major drawback of not using view holders could lead to a heavy operation of finding views by ids every time. Which resulted in laggy ListViews. This problem is solved in RecylerView by the use of RecyclerView.ViewHolder class. This is one of the major differences in RecyclerView and ListView. When implementing a RecyclerView this class is used to define a ViewHolder object which is used by the adapter to bind ViewHolder with a position. Another point to be noted here, is that while implementing the adapter for RecyclerView, providing a ViewHolder is compulsory. This makes the implementation a little complex, but solves the issues faced in ListView. 2. Layout Manager When speaking of ListViews, only one type of ListView is available i.e. the vertical ListView. You cannot implement a ListView with horizontal scroll. I know there are ways to implement a horizontal scroll, but believe me it was not designed to work that way. But now when we look at Android RecyclerView vs ListView, we have support for horizontal collections as well. In-fact it supports multiple types of lists. To support multiple types of lists it uses RecyclerView.LayoutManager class. This is something new that ListView does not have. RecyclerView supports three types of predefined Layout Managers: LinearLayoutManager – This is the most commonly used layout manager in case of RecyclerView. Through this, we can create both horizontal and vertical scroll lists. StaggeredGridLayoutManager – Through this layout manager, we can create staggered lists. Just like the Pinterest screen. GridLayoutManager– This layout manager can be used to display grids, like any picture gallery. 3. Item Animator Animations in a list is a whole new dimension, which has endless possibilities. In a ListView, as such there are no special provisions through which one can animate, addition or deletion of items. Instead later on as android evolvedViewPropertyAnimator was suggested by Google’s Chet Haase in this video tutorial for animations in ListView. On the other hand comparing Android RecyclerView vs ListView, it has RecyclerView.ItemAnimator class for handling animations. Through this class custom animations can be defined for item addition, deletion and move events. Also it provides aDefaultItemAnimator, in case you don’t need any customizations. 4. Adapter ListView adapters were simple to implement. They had a main method getView where all the magic used to happen. Where the views were bound to a position. Also they used to have an interesting method registerDataSetObserver where one can set an observer right in the adapter. This feature is also present in RecyclerView, but RecyclerView.AdapterDataObserver class is used for it. But the point in favor of ListView is that it supports three default implementations of adapters: ArrayAdapter CursorAdapter SimpleCursorAdapter Whereas RecyclerView adapter, has all the functionality that ListView adapters had except the built in support for DB cursors and ArrayLists. In RecyclerView.Adapter as of now we have to make a custom implementation to supply data to the adapter. Just like a BaseAdapter does for ListViews. Although if you wish to know more about RecyclerView adapter implementation, please refer to Android RecyclerView Example. 5. Item Decoration To display custom dividers in a ListView, one could have easily added these parameters in the ListView XML: XHTML 1 2 android:divider="@android:color/transparent" android:dividerHeight="5dp" The interesting part about Android RecyclerView is that, as of now it does not show a divider between items by default. Although the guys at Google must have left this out for customization, intentionally. But this greatly increases the effort for a developer. If you wish to add a divider between items, you may need to do a custom implementation by using RecyclerView.ItemDecorationclass. Or you can apply a hack by using this file from official samples: DividerItemDecoration.java 6. OnItemTouchListener Listviews used to have a simple implementation for detection of clicks, i.e. by the use of AdapterView.OnItemClickListenerinterface. But on the other hand RecyclerView.OnItemTouchListener interface is used to detect touch events in Android RecyclerView. It complicates the implementation a little, but it gives a greater control to the developer for intercepting touch events. The official documentation states, it can be useful for gestural manipulations as it intercepts a touch event before it is delivered to RecyclerView. 7. Conclusion I would like to conclude this Android RecyclerView vs ListView comparison by saying RecyclerView is filled will a lot customizable functionality. It can be very useful for implementing complex lists or grids. But also its a little difficult to implement as compared to ListView as it contains multiple classes where implementation is required. Hope this helped you decide.