Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android Design Support Library

Android Design Support Library

Soham Mondal

July 29, 2015
Tweet

More Decks by Soham Mondal

Other Decks in Technology

Transcript

  1. Soham Mondal - Founder at Triveous - Creator of Voice

    Recorder - Organizer at Blrdroid [email protected][email protected]
 @s0h4m www.soham.cc
  2. Agenda What is the Android Design Support Library?
 Navigation View


    Floating labels for editing text
 Floating action bar
 Snackbar
 Tab layout
 Coordinatorlayout
 Collapsing toolbar layout
 Codelab
  3. Android Design Support Library - brings material design components to

    your app (Android 2.1+) - these were in the material design spec but were not provided by Google before
  4. - Navigational shortcuts - Frequently used sections - Frequently used

    actions - Group navigational elements together - You can show numerical/other accompanying information
 - Icons also reflect the importance of the element - The order of the elements are important - Access to Settings/Help Common use cases
  5. - Mostly used by power users: difficult to discover, difficult

    to trigger - Not essential options for the most part, people might not notice this - You might want to inform the user about this option, keep it open or show a tutorial
 - Can be used on mobile, tablets and web - Context that is common to all pages, profile Navigation Drawer Gotchas
  6. <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <!-- your content layout

    --> <android.support.design.widget.NavigationView android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" app:headerLayout="@layout/drawer_header" app:menu="@menu/drawer"/> </android.support.v4.widget.DrawerLayout>
  7. - Just like the toast but more versatile - a)

    You can swipe it away - b) More than that, it is actionable, you can interact with the snackbar
 - c) It coordinates with other elements like the FAB Snackbar
  8. <android.support.design.widget.TabLayout android:id="@+id/sliding_tabs" android:layout_width="match_parent" android:layout_height="wrap_content" app:tabMode="fixed" app:tabGravity="fill" /> ViewPager pager =

    (ViewPager) rootView.findViewById(R.id.viewPager); pager.setAdapter(new MyPagerAdapter(getActivity().getSupportFragmentManager())); TabLayout tabLayout = (TabLayout) rootView.findViewById(R.id.sliding_tabs); tabLayout.addTab(tabLayout.newTab().setText("Tab One")); tabLayout.addTab(tabLayout.newTab().setText("Tab Two")); tabLayout.addTab(tabLayout.newTab().setText("Tab Three")); tabLayout.setupWithViewPager(pager);
  9. <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <! -- Your Scrollable View

    --> <android.support.v7.widget.RecyclerView android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.Toolbar ... app:layout_scrollFlags="scroll|enterAlways"> <android.support.design.widget.TabLayout ... app:layout_scrollFlags="scroll|enterAlways"> </android.support.design.widget.AppBarLayout> </android.support.design.widget.CoordinatorLayout>