SlideShare a Scribd company logo
1 of 20
Android Design Support
Library
nuuneoi
android.support.design.widget.FloatingActionButton
android:fabSize – normal (56dp), mini (40dp)
android:src – Icon’s resource
android:backgroundTint – Background color (accent
color will be used if not set)
There is some bug on API Level 21+ (Lollipop)
Floating Action Button (FAB)
android.support.design.widget.Snackbar
Just like a Toast
Snackbar.make(rootLayout, "Hello. I am Snackbar!", Snackbar.LENGTH_SHORT)
.setAction("Undo", new View.OnClickListener() {
@Override
public void onClick(View v) {
}
})
.show();
Snackbar
CoordinatorLayout
building dependencies between sibling views and allowing easy
scrolling reactions between components
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Place Views Inside -->
</android.support.design.widget.CoordinatorLayout
AppBarLayout
a container for Toolbar to make it fit in CoordinatorLayout
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
</android.support.design.widget.AppBarLayout>
<!-- Other views -->
</android.support.design.widget.CoordinatorLayout>
CoordinatorLayout’s Content
You need to apply
app:layout_behavior="@string/appbar_scrolling_view_behavior"
to the content view inside Coordinator or it will be placed at
the same position as where Toolbar is
CoordinatorLayout’s Content
<android.support.design.widget.CoordinatorLayout ...>
<android.support.design.widget.AppBarLayout ...>
...
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical“
app:layout_behavior="@string/appbar_scrolling_view_behavior" >
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
TabLayout
You could place tabs easily with TabLayout. Support for both
fixed and scrollable. Also works with ViewPager.
<android.support.design.widget.CoordinatorLayout ...>
<android.support.design.widget.AppBarLayout ...>
<android.support.v7.widget.Toolbar .../>
<android.support.design.widget.TabLayout
android:id=“@+id/tabLayout”
android:layout_width="match_parent“ android:layout_height="match_parent" />
</android.support.design.widget.AppBarLayout>
...
</android.support.design.widget.CoordinatorLayout>
TabLayout
tabLayout = (TabLayout) findViewById(R.id.tabLayout);
tabLayout.addTab(tabLayout.newTab().setText("Tab 1"));
tabLayout.addTab(tabLayout.newTab().setText("Tab 2"));
To manually add Tab(s)
TabLayout
Parameters:
app:tabMode – fixed (all tabs are shown concurrently)
– scrollable (show a subset of tabs)
app:tabGravity – fill (distribute all available space)
– center (position tabs in the center of
TabLayout)
CollapsingToolbarLayout
Make Toolbar collapsible
CollapsingToolbarLayout
Simply wrap Toolbar with this layout
<android.support.design.widget.AppBarLayout ...>
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent“ android:layout_height="match_parent“
app:contentScrim=“?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<android.support.v7.widget.Toolbar
app:layout_collapseMode=“pin“ .../>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
CollapsingToolbarLayout
Toolbar’s background is recommended to be removed
You can place another View inside at the same approach as
FrameLayout. Also with parallax support.
<android.support.design.widget.CollapsingToolbarLayout ...>
<ImageView
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7“
...>
<android.support.v7.widget.Toolbar .../>
</android.support.design.widget.CollapsingToolbarLayout>
NavigationView
Implementing Navigation Drawer
contents in very easy way
NavigationView
Define XML Layout for Header View
res/layout/nav_header.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="192dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_margin="16dp"
android:text="nuuneoi"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
</FrameLayout>
NavigationView
Define XML for Menu Items
res/menu/navigation_drawer_items.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<group android:checkableBehavior="all">
<item
android:id="@+id/navigation_item_1"
android:icon="@drawable/ic_action_location_found_dark"
android:title="Toolbar"/>
<item
android:id="@+id/navigation_item_2"
android:icon="@drawable/ic_action_location_found_dark"
android:title="FloatActionButton"/>
<item
android:id="@+id/navigation_item_3"
android:icon="@drawable/ic_action_location_found_dark"
android:title="NavigationView"/>
</group>
</menu>
NavigationView
Place NavigationView as navigation drawer of DrawerLayout
</android.support.v4.widget.DrawerLayout ...>
<android.support.design.widget.NavigationView
android:id="@+id/navigation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/nav_header"
app:itemIconTint="#333"
app:itemTextColor="#333"
app:menu="@menu/navigation_drawer_items" />
</android.support.v4.widget.DrawerLayout>
NavigationView
Result
TextInputLayout
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Username" />
</android.support.design.widget.TextInputLayout>
Wrap EditText with this layout to make hint and error text
shown as floating labels
Thank You
Q&A

More Related Content

What's hot

What's hot (20)

01 09 - graphical user interface - basic widgets
01  09 - graphical user interface - basic widgets01  09 - graphical user interface - basic widgets
01 09 - graphical user interface - basic widgets
 
Chapter 10 - Views Part 2
Chapter 10 - Views Part 2Chapter 10 - Views Part 2
Chapter 10 - Views Part 2
 
Hierarchy viewer
Hierarchy viewerHierarchy viewer
Hierarchy viewer
 
01 08 - graphical user interface - layouts
01  08 - graphical user interface - layouts01  08 - graphical user interface - layouts
01 08 - graphical user interface - layouts
 
Android layouts
Android layoutsAndroid layouts
Android layouts
 
12. Android Basic Google Map
12. Android Basic Google Map12. Android Basic Google Map
12. Android Basic Google Map
 
Advance Android application development workshop day 2
Advance Android application development workshop day 2Advance Android application development workshop day 2
Advance Android application development workshop day 2
 
Desenvolver para Chromecast
Desenvolver para ChromecastDesenvolver para Chromecast
Desenvolver para Chromecast
 
Basic Android Layout
Basic Android LayoutBasic Android Layout
Basic Android Layout
 
2011 08-24 mobile web app
2011 08-24  mobile web app2011 08-24  mobile web app
2011 08-24 mobile web app
 
Android Widget
Android WidgetAndroid Widget
Android Widget
 
Android Layout
Android LayoutAndroid Layout
Android Layout
 
Android best practices
Android best practicesAndroid best practices
Android best practices
 
10 asp.net session14
10 asp.net session1410 asp.net session14
10 asp.net session14
 
04 user interfaces
04 user interfaces04 user interfaces
04 user interfaces
 
Activity
ActivityActivity
Activity
 
4.preference management
4.preference management 4.preference management
4.preference management
 
Designing and implementing_android_uis_for_phones_and_tablets
Designing and implementing_android_uis_for_phones_and_tabletsDesigning and implementing_android_uis_for_phones_and_tablets
Designing and implementing_android_uis_for_phones_and_tablets
 
Android development session 3 - layout
Android development   session 3 - layoutAndroid development   session 3 - layout
Android development session 3 - layout
 
Android N Highligts
Android N HighligtsAndroid N Highligts
Android N Highligts
 

Similar to I/O Rewind 2015 : Android Design Support Library

UI2code : A Neural Machine Translator to Bootstrap Mobile GUI Implementation
UI2code : A Neural Machine Translator to Bootstrap Mobile GUI ImplementationUI2code : A Neural Machine Translator to Bootstrap Mobile GUI Implementation
UI2code : A Neural Machine Translator to Bootstrap Mobile GUI Implementation
Chunyang Chen
 
Native look and feel bbui & alicejs
Native look and feel bbui & alicejsNative look and feel bbui & alicejs
Native look and feel bbui & alicejs
.toster
 
android layouts
android layoutsandroid layouts
android layouts
Deepa Rani
 

Similar to I/O Rewind 2015 : Android Design Support Library (20)

Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?
 
Android development for iOS developers
Android development for iOS developersAndroid development for iOS developers
Android development for iOS developers
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app development
 
Infinum Android Talks #13 - Design Support Library by Ivan Markusi
Infinum Android Talks #13 - Design Support Library by Ivan MarkusiInfinum Android Talks #13 - Design Support Library by Ivan Markusi
Infinum Android Talks #13 - Design Support Library by Ivan Markusi
 
Swift
SwiftSwift
Swift
 
Droidcon Moscow 2015. Support Design Library. Григорий Джанелидзе - e-Legion
Droidcon Moscow 2015. Support Design Library. Григорий Джанелидзе - e-LegionDroidcon Moscow 2015. Support Design Library. Григорий Джанелидзе - e-Legion
Droidcon Moscow 2015. Support Design Library. Григорий Джанелидзе - e-Legion
 
Support Design Library
Support Design LibrarySupport Design Library
Support Design Library
 
What's New in Android
What's New in AndroidWhat's New in Android
What's New in Android
 
Android ui patterns
Android ui patternsAndroid ui patterns
Android ui patterns
 
Android ui patterns
Android ui patternsAndroid ui patterns
Android ui patterns
 
GUI design using JAVAFX.ppt
GUI design using JAVAFX.pptGUI design using JAVAFX.ppt
GUI design using JAVAFX.ppt
 
UI2code : A Neural Machine Translator to Bootstrap Mobile GUI Implementation
UI2code : A Neural Machine Translator to Bootstrap Mobile GUI ImplementationUI2code : A Neural Machine Translator to Bootstrap Mobile GUI Implementation
UI2code : A Neural Machine Translator to Bootstrap Mobile GUI Implementation
 
Native look and feel bbui & alicejs
Native look and feel bbui & alicejsNative look and feel bbui & alicejs
Native look and feel bbui & alicejs
 
android layouts
android layoutsandroid layouts
android layouts
 
Android Material Design APIs/Tips
Android Material Design APIs/TipsAndroid Material Design APIs/Tips
Android Material Design APIs/Tips
 
Taking control of Storyboard
Taking control of StoryboardTaking control of Storyboard
Taking control of Storyboard
 
06 UI Layout
06 UI Layout06 UI Layout
06 UI Layout
 
07_UIAndroid.pdf
07_UIAndroid.pdf07_UIAndroid.pdf
07_UIAndroid.pdf
 
Modern Android UI, or not by Action Bar alone
Modern Android UI, or not by Action Bar aloneModern Android UI, or not by Action Bar alone
Modern Android UI, or not by Action Bar alone
 
Ux Example
Ux ExampleUx Example
Ux Example
 

More from Sittiphol Phanvilai

GTUG Bangkok 2011 Android Ecosystem Session
GTUG Bangkok 2011 Android Ecosystem SessionGTUG Bangkok 2011 Android Ecosystem Session
GTUG Bangkok 2011 Android Ecosystem Session
Sittiphol Phanvilai
 

More from Sittiphol Phanvilai (11)

Smart Contract programming 101 with Solidity #PizzaHackathon
Smart Contract programming 101 with Solidity #PizzaHackathonSmart Contract programming 101 with Solidity #PizzaHackathon
Smart Contract programming 101 with Solidity #PizzaHackathon
 
Firebase Dev Day Bangkok: Keynote
Firebase Dev Day Bangkok: KeynoteFirebase Dev Day Bangkok: Keynote
Firebase Dev Day Bangkok: Keynote
 
Introduction to Firebase [Google I/O Extended Bangkok 2016]
Introduction to Firebase [Google I/O Extended Bangkok 2016]Introduction to Firebase [Google I/O Extended Bangkok 2016]
Introduction to Firebase [Google I/O Extended Bangkok 2016]
 
What’s new in aNdroid [Google I/O Extended Bangkok 2016]
What’s new in aNdroid [Google I/O Extended Bangkok 2016]What’s new in aNdroid [Google I/O Extended Bangkok 2016]
What’s new in aNdroid [Google I/O Extended Bangkok 2016]
 
I/O Rewind 215: What's new in Android
I/O Rewind 215: What's new in AndroidI/O Rewind 215: What's new in Android
I/O Rewind 215: What's new in Android
 
The way Tech World is heading to and how to survive in this fast moving world
The way Tech World is heading to and how to survive in this fast moving worldThe way Tech World is heading to and how to survive in this fast moving world
The way Tech World is heading to and how to survive in this fast moving world
 
Mobile Dev Talk #0 Keynote & Mobile Trend 2015
Mobile Dev Talk #0 Keynote & Mobile Trend 2015Mobile Dev Talk #0 Keynote & Mobile Trend 2015
Mobile Dev Talk #0 Keynote & Mobile Trend 2015
 
Tech World 2015
Tech World 2015Tech World 2015
Tech World 2015
 
Mobile Market : Past Present Now and Then
Mobile Market : Past Present Now and ThenMobile Market : Past Present Now and Then
Mobile Market : Past Present Now and Then
 
How to deal with Fragmentation on Android
How to deal with Fragmentation on AndroidHow to deal with Fragmentation on Android
How to deal with Fragmentation on Android
 
GTUG Bangkok 2011 Android Ecosystem Session
GTUG Bangkok 2011 Android Ecosystem SessionGTUG Bangkok 2011 Android Ecosystem Session
GTUG Bangkok 2011 Android Ecosystem Session
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

I/O Rewind 2015 : Android Design Support Library

  • 2. android.support.design.widget.FloatingActionButton android:fabSize – normal (56dp), mini (40dp) android:src – Icon’s resource android:backgroundTint – Background color (accent color will be used if not set) There is some bug on API Level 21+ (Lollipop) Floating Action Button (FAB)
  • 3. android.support.design.widget.Snackbar Just like a Toast Snackbar.make(rootLayout, "Hello. I am Snackbar!", Snackbar.LENGTH_SHORT) .setAction("Undo", new View.OnClickListener() { @Override public void onClick(View v) { } }) .show(); Snackbar
  • 4. CoordinatorLayout building dependencies between sibling views and allowing easy scrolling reactions between components <android.support.design.widget.CoordinatorLayout android:layout_width="match_parent" android:layout_height="match_parent"> <!-- Place Views Inside --> </android.support.design.widget.CoordinatorLayout
  • 5. AppBarLayout a container for Toolbar to make it fit in CoordinatorLayout <android.support.design.widget.CoordinatorLayout android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" app:layout_collapseMode="pin" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" /> </android.support.design.widget.AppBarLayout> <!-- Other views --> </android.support.design.widget.CoordinatorLayout>
  • 6. CoordinatorLayout’s Content You need to apply app:layout_behavior="@string/appbar_scrolling_view_behavior" to the content view inside Coordinator or it will be placed at the same position as where Toolbar is
  • 7. CoordinatorLayout’s Content <android.support.design.widget.CoordinatorLayout ...> <android.support.design.widget.AppBarLayout ...> ... </android.support.design.widget.AppBarLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical“ app:layout_behavior="@string/appbar_scrolling_view_behavior" > </LinearLayout> </android.support.design.widget.CoordinatorLayout>
  • 8. TabLayout You could place tabs easily with TabLayout. Support for both fixed and scrollable. Also works with ViewPager. <android.support.design.widget.CoordinatorLayout ...> <android.support.design.widget.AppBarLayout ...> <android.support.v7.widget.Toolbar .../> <android.support.design.widget.TabLayout android:id=“@+id/tabLayout” android:layout_width="match_parent“ android:layout_height="match_parent" /> </android.support.design.widget.AppBarLayout> ... </android.support.design.widget.CoordinatorLayout>
  • 9. TabLayout tabLayout = (TabLayout) findViewById(R.id.tabLayout); tabLayout.addTab(tabLayout.newTab().setText("Tab 1")); tabLayout.addTab(tabLayout.newTab().setText("Tab 2")); To manually add Tab(s)
  • 10. TabLayout Parameters: app:tabMode – fixed (all tabs are shown concurrently) – scrollable (show a subset of tabs) app:tabGravity – fill (distribute all available space) – center (position tabs in the center of TabLayout)
  • 12. CollapsingToolbarLayout Simply wrap Toolbar with this layout <android.support.design.widget.AppBarLayout ...> <android.support.design.widget.CollapsingToolbarLayout android:layout_width="match_parent“ android:layout_height="match_parent“ app:contentScrim=“?attr/colorPrimary" app:layout_scrollFlags="scroll|exitUntilCollapsed"> <android.support.v7.widget.Toolbar app:layout_collapseMode=“pin“ .../> </android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout>
  • 13. CollapsingToolbarLayout Toolbar’s background is recommended to be removed You can place another View inside at the same approach as FrameLayout. Also with parallax support. <android.support.design.widget.CollapsingToolbarLayout ...> <ImageView app:layout_collapseMode="parallax" app:layout_collapseParallaxMultiplier="0.7“ ...> <android.support.v7.widget.Toolbar .../> </android.support.design.widget.CollapsingToolbarLayout>
  • 15. NavigationView Define XML Layout for Header View res/layout/nav_header.xml <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="192dp" android:theme="@style/ThemeOverlay.AppCompat.Dark" > <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" android:layout_margin="16dp" android:text="nuuneoi" android:textAppearance="@style/TextAppearance.AppCompat.Body1"/> </FrameLayout>
  • 16. NavigationView Define XML for Menu Items res/menu/navigation_drawer_items.xml <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <group android:checkableBehavior="all"> <item android:id="@+id/navigation_item_1" android:icon="@drawable/ic_action_location_found_dark" android:title="Toolbar"/> <item android:id="@+id/navigation_item_2" android:icon="@drawable/ic_action_location_found_dark" android:title="FloatActionButton"/> <item android:id="@+id/navigation_item_3" android:icon="@drawable/ic_action_location_found_dark" android:title="NavigationView"/> </group> </menu>
  • 17. NavigationView Place NavigationView as navigation drawer of DrawerLayout </android.support.v4.widget.DrawerLayout ...> <android.support.design.widget.NavigationView android:id="@+id/navigation" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" app:headerLayout="@layout/nav_header" app:itemIconTint="#333" app:itemTextColor="#333" app:menu="@menu/navigation_drawer_items" /> </android.support.v4.widget.DrawerLayout>