Anko - 自定义警报未显示

Anko - Custom Alert not showing

我使用 Anko DSL 制作了这个警报,并且没有在分辨率较低的设备上显示。

   dialog = alert {
                customView {
                    verticalLayout {
                        backgroundColor = Color.WHITE
                        textView {
                            text = context.getString(R.string.delete_sessions)
                            padding = 8
                            textSize = 16f
                            textAlignment = View.TEXT_ALIGNMENT_CENTER
                            textColor = Color.BLACK
                            typeface = ResourcesCompat.getFont(context, R.font.rubik)
                        }
                        linearLayout {
                            gravity = Gravity.END
                            padding = 16
                            button {
                                text = context.getString(R.string.no)
                                textColor = Color.parseColor("#FF1A40")
                                backgroundColor = Color.WHITE
                                onClick {
                                    dialog.dismiss()
                                }
                            }
                            button {
                                text = context.getString(R.string.yes)
                                textColor = Color.parseColor("#3A92CC")
                                backgroundColor = Color.WHITE
                                onClick {
                                    dialog.dismiss()
                                    val list = this@SessionsFragment.getSelectedList()
                                    if (list != null)
                                        vm.deleteList(list)

                                }
                            }
                        }
                    }
                }
            }.show()

如果我不使用 customview{ } 中的所有内容,它就可以工作。 例如:

alert{
  message = "something"
   customView{}
}.show()

在高分辨率设备中,警报显示正常。 我正在 5' 1080x1920 密度 480 (Genymotion)

中进行测试

我删除了字体,它起作用了。

typeface = ResourcesCompat.getFont(context, R.font.rubik)