Toolbar's popup menu - custom background (colo

2019-08-30 05:22发布

问题:

How can I make such popup item menu for my toolbar (support v7)?

screenshot of transparent toolbar's popup menu (MX Player)

I found out how to make transparent background:

from layout

  <android.support.v7.widget.Toolbar
      android:id="@+id/toolbar"
      android:layout_width="match_parent"
      android:layout_height="?attr/actionBarSize"
      android:theme="@style/MyToolbarTheme"/>

from style

  <style name="ToolbarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
    <item name="android:colorBackground">@color/my_transparent_color</item>
  </style>

but how to add borders?

p.s. using shape android:background will cause a lot of shapes everywhere

<item name="android:background">@drawable/background_with_borders</item>