我正在使用Material Components Library的最新版本。 当前是:
com.google.android.material:material:1.1.0-alpha09
根据documentation,可以使用样式中的 shapeAppearanceOverlay
属性来自定义组件形状。
应该支持以下组件:
我可以将属性应用于Menu之外的这些组件,尤其是PopupMenu
。我在素材主题中寻找它,但没有找到它。
我尝试过类似的方法,但是不起作用:
<!-- Popup Menu -->
<style name="Widget.MyApp.PopupMenu" parent="@style/Widget.MaterialComponents.PopupMenu">
<item name="shapeAppearanceOverlay">@style/ShapeAppearanceOverlay.MyApp.PopupMenu</item>
</style>
<style name="ShapeAppearanceOverlay.MyApp.PopupMenu" parent="">
<item name="cornerFamily">cut</item>
<item name="cornerSize">32dp</item>
</style>