Android Design Support Library : Basics

1 Welcome To The AppCompat Activity

This Material Design Tutorial shows an example of AppCompatActivity which was introduced in API v22.0, Use the AppCompatActivity or AppCompatDelegate with a normal Activity to mirror the different Activity methods to add a Toolbar to it. Use tinted versions of widgets like AppCompatButton, AppCompatAutoCompleteTextView and so on along with a custom AlertDialog that looks the same across different devices. This would be your first step venturing into the Android Design Support Library APIs.

2 Hello Navigation View

This Android Tutorial shows how to use the android navigation view. Create a new project, add gradle dependency for appcompat and android design support library, add an Activity and add a navigationview inside the activity_main.xml Define the items inside menu_header and use the app:menu attribute to specify items that must appear inside the NavigationView.

3 Navigation View : How To Group Stuff?

This Android Tutorial shows how to add groups and headers to the navigationview in android which is part of the design support library. Create a group tag to add items within inside the menu.xml file, Create an object of ActionBarDrawerToggle, Toolbar, DrawerLayout and link them together. Edit the groups and add headers with the item tag having its own menu.

4 Navigation View : How to handle Click Events?

This Android Tutorial shows an example of the NavigationView.OnNavigationItemSelectedListener which has the onNavigationItemSelected method where you can decide what to do with your selected item, whether launching a new activity or switching to a different fragment. Use SharedPreferences to determine if the NavigationDrawer should be shown to the user the subsequent time or not. Override the onBackPressed method to close the Drawer

5 Text Input Layout + Floating Action Button + Snackbar

This Android Tutorial shows an example of TextInputLayout, FloatingActionButton and Snackbar from Android Design Support Library. Surround an EditText With TextInputLayout to present hints about the edittext while the user types. Create a FloatingActionButton by specifying its ripple color, border width, size and icon to be displayed since its a subclass of ImageView. Create the Snackbar in the same way you create a Toast using the make method, pass the Root Layout to which this Snackbar must be attached to.

6 Android Tab Layout Example : How to create Swipe + Scroll Tabs?

This Android Tutorial shows an example of TabLayout from Android design support library to make fixed and scrolling tabs with ViewPager. Create a TabLayout below Toolbar and give it the background colorPrimary Create a ViewPager with a PagerAdapter and link the ViewPager with the TabLayout using the setupWithViewPager method, Add a PageChangeListener that accepts the TabLayout

7 Everything put together? How does it look?

design support library demo

How does it work?

This video shows you how to integrate different components of the Android Design Support Library which would include the Coordinator Layout, App Bar Layout, the Collapsing Toolbar Layout, the View Pager, the Navigation View, the Drawer Layout, the Recycler View.

Where is the code?

Here you go…