我的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>