阻止AlertDialog全屏显示?

时间:2019-12-30 09:16:33

标签: android kotlin

我的alertDialog在android 8.1.0中可以,但是在4.4.4中是全屏的

    val builder = AlertDialog.Builder(this, R.style.AppCompatAlertDialogStyle)
    builder.setMessage(getString(R.string.sign_out_message))
    builder.setNegativeButton(R.string.action_no) { _, _ -> }
    builder.setPositiveButton(R.string.sign_out) { _, _ ->

    }
    val alertDialog = builder.create()
    alertDialog?.requestWindowFeature(Window.FEATURE_NO_TITLE)
    alertDialog.show()

我的风格

<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:textColorPrimary">@color/textColorPrimary</item>
    <item name="android:background">@color/white</item>
</style>

0 个答案:

没有答案