我想知道有什么方法可以实现吗?问题仅在于styles.xml代码的修改,而不是通过编程自定义布局来进行自定义对话框。
答案 0 :(得分:0)
您可以使用customize the shape和 shapeAppearanceOverlay
属性AlertDialog
中的Material Theme组件。
类似的东西:
<!-- Alert Dialog -->
<style name="MyThemeOverlayAlertDialog" parent="@style/ThemeOverlay.MaterialComponents.MaterialAlertDialog">
<item name="shapeAppearanceOverlay">@style/ShapeAppearanceOverlay.MyApp.Dialog.Rounded</item>
</style>
<style name="ShapeAppearanceOverlay.MyApp.Dialog.Rounded" parent="">
<item name="cornerFamily">rounded</item>
<item name="cornerSize">8dp</item>
</style>
它需要材料组件库的1.1.0版本。