I have added the shareActionProvider for the tool bar my problem is as soon as i tap on share icon the popup menu will cover the toolbar content but when i tap on see all option listed under the popup menu , the popup menu will perfectly settle below the tool bar.
My requirement is as soon as i tap on share icon my popup menu should be populated below the tool bar not after i select the see all option.
menu.xml
<item
android:id="@+id/menu_item_share"
app:showAsAction="always"
android:title="Share"
android:icon="@drawable/abc_ic_menu_share_mtrl_alpha"/>
Java code
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
MenuItem item = menu.findItem(R.id.menu_item_share);
mShareActionProvider = new ShareActionProvider(getActivity()) {
@Override
public View onCreateActionView() {
return null;
}
};
MenuItemCompat.setActionProvider(item, mShareActionProvider);
if (mShareActionProvider != null) {
mShareActionProvider.setShareIntent(createShareIntent());
}
}
style.xml
<style name="AppTheme.Base" parent="Theme.AppCompat.Light">
<item name="actionOverflowMenuStyle">@style/PopupMenu</item>
</style>
<style name="PopupMenu" parent="Widget.AppCompat.PopupMenu.Overflow">
<item name="android:popupBackground">@color/colorPrimary</item>
<!-- Required for pre-Lollipop. -->
<item name="overlapAnchor">false</item>
<item name="android:dropDownVerticalOffset">-4.0dip</item>
<!-- Required for Lollipop. -->
<item name="android:overlapAnchor">false</item>
<item name="android:dropDownVerticalOffset">-4.0dip</item>
</style>