使用com.google.android.material:material:1.0.0和androidx.appcompat.app.AlertDialog时,您可以使用buttonBar作为父级来自定义Widget.MaterialComponents.Button.TextButton中的每个按钮。
val builder: AlertDialog.Builder = AlertDialog.Builder(ContextThemeWrapper(context, R.style.AlertDialogTheme))
使用默认布局或通过builder.setView(R.layout.my_dialog)添加自定义
在你的风格:
@style/Alert.Button.Positive
@style/Alert.Button.Neutral
@style/Alert.Button.Neutral
@color/transparent
@color/colorAccent
@color/colorPrimary
14sp
false
@color/transparent
@color/colorAccent
@color/gray_dark
14sp