Using API21+ Toolbar
:
// Toolbar
Toolbar toolbar = new Toolbar(this);
toolbar.showOverflowMenu();
Would like to remove its shadow
Use attribute app:elevation="0dp"
to your Toolbar
or AppBarLayout
to remove the shadow.
#. If you are using Toolbar
only, then add attribute app:elevation="0dp"
to Toolbar
.
#. If you are using AppBarLayout
as a container of Toolbar
, then add attribute app:elevation="0dp"
to AppBarLayout
.
OUTPUT:
UPDATE:
If you want to remove it programmatically then you can use below code:
getSupportActionBar().setElevation(0);
Hope this will help~