Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.


102 visualizaciones

Publicado el

Toolbar example in android it is a beginners tutorial

Publicado en: Educación
  • Sé el primero en comentar

  • Sé el primero en recomendar esto


  1. 1. ToolBar In Android Example
  2. 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. 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. 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 '' compile '' }
  5. 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. 6. Now add a Toolbar to your Activity in layout file ● <LinearLayout xmlns:android=""> < android:id="@+id/tb_toolbarmain" android:layout_height="?attr/actionBarSize" android:background="@color/colorPrimaryDark" > </> <View android:layout_width="match_parent" android:layout_height="10dp" android:background="@drawable/toolbar_dropshadow" /> </LinearLayout>