使用androidx DialogFragment创建AlertDialog时按钮样式错误 [英] Wrong button style when creating AlertDialog with androidx DialogFragment
本文介绍了使用androidx DialogFragment创建AlertDialog时按钮样式错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的根风格:
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
这是我创建对话框的方式:
And here is how I create dialog:
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return AlertDialog.Builder(requireActivity())
.apply {
setMessage(R.string.dialog_delete_service_message)
setPositiveButton(
R.string.dialog_delete_service_positive_button
) { _, _ ->
listener?.onConfirmed()
}
setNegativeButton(R.string.dialog_delete_service_negative_button, null)
}.create()
}
Fragment是androidx.fragment.app.DialogFragment
的子类.
Fragment is subclass of androidx.fragment.app.DialogFragment
.
以下是对话框的显示方式:
Here is how dialog is shown:
我想显示无边框按钮,但对话框按钮带有边框.是否缺少任何样式?
I want to show borderless buttons but dialog buttons are bordered. Is any style missing?
推荐答案
查看全文