Description for Toolbar in Android:

In Android toolbar is similar to an actor bar. Toolbar is a view group that can be placed at any where in layout. We can eaisly replace an action bar with toolbar.toolbar provides more features than action bar . A toolbar may contain a combination of elements from start to end.
Steps to use toolbar given below
Add new activity 
In design add toolbar
Set constraints for toolbar.
Add textview and Give name it to like toolbar or any other set constraints for textview.
In styles.xml set theme of tool bar dark action bar
In activity main xml- add Android I’d :name =main activity”
In main activity write code given below
Set support action bar(toolbar)
Override fun on createoption menu(menu:menu?):boolean{
menu inflated.inflatr(,menu)
return true
Override fun on optionsitemselected(item:menu item):boolean{
Val msg =when(item.(itemid)
{ menu(item_add->”add is clicked” menu(item_update->”update is clicked” .menu(item_delete->”delete is clicked” text 1->”text one is clicked” text2->”text two is clicked”
else->”settings is clicked”
Toast.maketext{(context this.msg,
return true

Youtube video link:

Leave a Reply

Your email address will not be published. Required fields are marked *