SlideShare a Scribd company logo
ToolBar In Android Example
● Toolbar is a view introduced in Android Lollipop(API 21)
the spiritual successor of the ActionBar(Actionbar is
replaced with Toolbar)
● Appearance and behaviour can be more easily
customized than the ActionBar.
● Works well with app’s targeted to API 21 and above.
● Android has updated the AppCompat support libraries
so the Toolbar can be used on lower Android OS
devices as well.
Toolbar Advantages
● Toolbar is a View included in a layout like any
other View
● As a regular View, the toolbar is easier to
position, animate and control
Using Toolbar as Action-Bar
● To use Toolbar as an ActionBar, first ensure the AppCompat-
v7 support library is added to your application
build.gradle (Module:app) file:
● dependencies {
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
}
disable the theme-provided
ActionBar
● res/styles.xml file:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
Now add a Toolbar to your Activity
in layout file
● <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
<android.support.v7.widget.Toolbar
android:id="@+id/tb_toolbarmain"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimaryDark"
>
</android.support.v7.widget.Toolbar>
<View
android:layout_width="match_parent"
android:layout_height="10dp"
android:background="@drawable/toolbar_dropshadow" />
</LinearLayout>
Toolbarexample

More Related Content

PDF
Yaazli International Web Project Workshop
DOCX
Java Exception handling
PDF
Yaazli International AngularJS 5 Training
PDF
Yaazli International Hibernate Training
PPT
02basics
DOC
Non ieee dot net projects list
PPTX
For Loops and Variables in Java
PDF
Yaazli International Spring Training
Yaazli International Web Project Workshop
Java Exception handling
Yaazli International AngularJS 5 Training
Yaazli International Hibernate Training
02basics
Non ieee dot net projects list
For Loops and Variables in Java
Yaazli International Spring Training

Viewers also liked (17)

PPTX
Exception handling in java
PDF
Java quick reference v2
PPTX
Core java online training
PPT
09events
PDF
Java Basic Operators
DOC
Non ieee java projects list
ODP
Singleton pattern
PPSX
DIWE - Using Extensions and Image Manipulation
PPSX
DIWE - Multimedia Technologies
PDF
Yaazli International Java Training
PPT
java swing
PPTX
Java notes 1 - operators control-flow
DOC
Short definitions of all testing types
DOCX
Loadrunner interview questions and answers
PDF
9-java language basics part3
PDF
SAP BI 7.0 Info Providers
Exception handling in java
Java quick reference v2
Core java online training
09events
Java Basic Operators
Non ieee java projects list
Singleton pattern
DIWE - Using Extensions and Image Manipulation
DIWE - Multimedia Technologies
Yaazli International Java Training
java swing
Java notes 1 - operators control-flow
Short definitions of all testing types
Loadrunner interview questions and answers
9-java language basics part3
SAP BI 7.0 Info Providers
Ad

Similar to Toolbarexample (14)

PDF
Android Support Library: Using ActionBarCompat
PPTX
ActionBarCompat Tutorial-Part 1(Prepare and Setup)
PDF
Material Theme
PPTX
Chapter 2 lesson-2 styling the action bar
PPTX
Chapter 2 lesson-1 adding the action bar
ODP
Android App Development - 05 Action bar
PPTX
All the support you need. Support libs in Android
POT
Android Material Design
PDF
Using android's action bar
PDF
Android Develpment vol. 3, MFF UK, 2015
PDF
Android Lollipop and Material Design
PPTX
Android ui with xml
PDF
Android development 1july
DOCX
Android action bar and notifications-chapter16
Android Support Library: Using ActionBarCompat
ActionBarCompat Tutorial-Part 1(Prepare and Setup)
Material Theme
Chapter 2 lesson-2 styling the action bar
Chapter 2 lesson-1 adding the action bar
Android App Development - 05 Action bar
All the support you need. Support libs in Android
Android Material Design
Using android's action bar
Android Develpment vol. 3, MFF UK, 2015
Android Lollipop and Material Design
Android ui with xml
Android development 1july
Android action bar and notifications-chapter16
Ad

More from yugandhar vadlamudi (13)

PPT
Object Relational model for SQLIite in android
DOCX
JButton in Java Swing example
PPTX
Collections framework in java
PPTX
Packaes & interfaces
DOCX
JMenu Creation in Java Swing
DOCX
Adding a action listener to button
PPTX
Dynamic method dispatch
PPTX
Operators in java
PPTX
Inheritance
PPTX
Control flow statements in java
PPTX
Closer look at classes
PPTX
java Applet Introduction
PPTX
Class introduction in java
Object Relational model for SQLIite in android
JButton in Java Swing example
Collections framework in java
Packaes & interfaces
JMenu Creation in Java Swing
Adding a action listener to button
Dynamic method dispatch
Operators in java
Inheritance
Control flow statements in java
Closer look at classes
java Applet Introduction
Class introduction in java

Recently uploaded (20)

PDF
01-Introduction-to-Information-Management.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Computing-Curriculum for Schools in Ghana
PPTX
Cell Structure & Organelles in detailed.
PDF
Basic Mud Logging Guide for educational purpose
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
RMMM.pdf make it easy to upload and study
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Lesson notes of climatology university.
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
GDM (1) (1).pptx small presentation for students
01-Introduction-to-Information-Management.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPH.pptx obstetrics and gynecology in nursing
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Computing-Curriculum for Schools in Ghana
Cell Structure & Organelles in detailed.
Basic Mud Logging Guide for educational purpose
Supply Chain Operations Speaking Notes -ICLT Program
102 student loan defaulters named and shamed – Is someone you know on the list?
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
RMMM.pdf make it easy to upload and study
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
Lesson notes of climatology university.
Abdominal Access Techniques with Prof. Dr. R K Mishra
Renaissance Architecture: A Journey from Faith to Humanism
GDM (1) (1).pptx small presentation for students

Toolbarexample

  • 2. ● Toolbar is a view introduced in Android Lollipop(API 21) the spiritual successor of the ActionBar(Actionbar is replaced with Toolbar) ● Appearance and behaviour can be more easily customized than the ActionBar. ● Works well with app’s targeted to API 21 and above. ● Android has updated the AppCompat support libraries so the Toolbar can be used on lower Android OS devices as well.
  • 3. Toolbar Advantages ● Toolbar is a View included in a layout like any other View ● As a regular View, the toolbar is easier to position, animate and control
  • 4. Using Toolbar as Action-Bar ● To use Toolbar as an ActionBar, first ensure the AppCompat- v7 support library is added to your application build.gradle (Module:app) file: ● dependencies { compile 'com.android.support:appcompat-v7:25.2.0' compile 'com.android.support:design:25.2.0' }
  • 5. disable the theme-provided ActionBar ● res/styles.xml file: <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> </style> </resources>
  • 6. Now add a Toolbar to your Activity in layout file ● <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"> <android.support.v7.widget.Toolbar android:id="@+id/tb_toolbarmain" android:layout_height="?attr/actionBarSize" android:background="@color/colorPrimaryDark" > </android.support.v7.widget.Toolbar> <View android:layout_width="match_parent" android:layout_height="10dp" android:background="@drawable/toolbar_dropshadow" /> </LinearLayout>