My Question is how i can move my menu dropdown to the space with pink area(see second image).As if now it is appearing in the Action Bar area too that i don't want.I want my menu to be appear just below the Action bar.
Please guys help me out to solve this situation.

This is how menu is coming.

I want my menu to appear just below the Action Bar.
This is how my menu.xml looks like
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.example.mobileinventorysuit.MainActivity" >
<item
android:id="@+id/login_mnu_imports"
android:icon="@drawable/import_menu"
app:showAsAction="always"
style="@style/OverflowMenu"
android:title="Import"/>
<item
android:id="@+id/login_mnu_settings"
android:icon="@drawable/settings_menu"
style="@style/OverflowMenu"
app:showAsAction="always"
android:title="Settings"/>
<item
android:id="@+id/login_mnu_dev"
android:icon="@drawable/dev"
style="@style/OverflowMenu"
app:showAsAction="always"
android:title="Device Info"/>
<item
android:id="@+id/login_mnu_exit"
style="@style/OverflowMenu"
app:showAsAction="always"
android:icon="@drawable/ic_lock_power_off"
android:title="Exit"/>
</menu>
Actually the ActionBar menu should display on top of the action bar.
From the Documentation
A menu is a temporary sheet of paper that always overlaps the app bar, rather than behaving as an extension of the app bar.
If you still want that behaviour you can use this. But its not recommended.
<style name="OverflowMenu" parent="Widget.AppCompat.PopupMenu.Overflow" >
<item name="overlapAnchor">false</item>
<item name="dropDownVerticalOffset">?attr/actionBarSize</item>
</style>
Check this answer Why is my overflow dropdown menu on top of the actionbar?
If you want icons placed in your ToolBar
add this in menu.xml
xmlns:app="http://schemas.android.com/apk/res-auto"
and add this line in your menuitems
app:showAsAction="always"
Go to res => values => styles and add those two lines I indicated in the comment below.It will help you
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
//add these two line scripts and it will work properly
<item name="overlapAnchor">false</item>
<item name="android:dropDownVerticalOffset">?attr/actionBarSize</item>
</style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With