Anko: Is this bug for alert button in Material Components Theme?

Created on 22 Feb 2019  ·  8Comments  ·  Source: Kotlin/anko

when I import design 28.0.0,and theme use "Theme.MaterialComponents.Light.NoActionBar",
I build a alert dialog by Anko:

alert("是否提交所选的类型?") {
            yesButton {
                submit()
            }
            noButton {
                super.onBackPressed()
            }
        }.show()

preview:
image
I build a alert dialog by normal:(import android.support.v7.app.AlertDialog)

val dialog = AlertDialog.Builder(ctx)
        dialog.setMessage("是否提交所选的类型?")
        dialog.setPositiveButton("提交") { _, _ ->
            submit()
        }
        dialog.setNegativeButton("关闭") { _, _ ->
            finish()
        }
        dialog.create().show()

preview:
image

I'm not sure this is Anko's bug,alert{} is import android.app.AlertDialog seems to be a must,but what should I do if I want use alert{} in Material Components? explain a style,or create extensions function use v7.AlertDialog?

Most helpful comment

I have this issue as well since migration to androidx, how can we fix this?

All 8 comments

I am seeing the same issue. Just started my material design theme conversion today and I have the same smashed button look.

I have this issue as well since migration to androidx, how can we fix this?

Try to change your style.xml file

2019年3月3日(日) 午後10:20 Benjoyo notifications@github.com:

I have this issue as well since migration to androidx, how can we fix this?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/Kotlin/anko/issues/731#issuecomment-469022320, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ASlPYzzuV_IHpNRL_0vX3yHlfM8Dw43iks5vS8w6gaJpZM4bItjR
.

Use AppCompat version:

alert(Appcompat, "Some text message").show()

if you append ".Bridge" to your app themes parent it displays correctly: