【问题标题】:MaterialTimePicker AM and PM width position incorrectMaterialTimePicker AM 和 PM 宽度位置不正确
【发布时间】:2021-03-15 23:29:03
【问题描述】:

我正在使用材料库版本 1.4.0-alpha01。

我在尝试显示时间选择器对话框时看到了上述内容。我尝试了 1.3 版,但我仍然看到这个。

有谁知道如何解决上述问题,使 AM/PM 处于正确的位置和宽度?

这是我用来显示时间选择器对话框的代码:

val picker =
                    MaterialTimePicker.Builder()
                            .setTimeFormat(TimeFormat.CLOCK_12H)
                            .setHour(HOUR_OF_DAY)
                            .setMinute(MINUTE)
                            .setTitleText("Select time")
                            .build()

            picker.show(this.supportFragmentManager, "SelectStartTime")

【问题讨论】:

    标签: java android kotlin material-components-android


    【解决方案1】:

    发现问题出在 androidx.constraintlayout:constraintlayout:2.1.0-alpha2 升级到 androidx.constraintlayout:constraintlayout:2.1.0-beta01 解决了这个问题。

        implementation 'androidx.constraintlayout:constraintlayout:2.1.0-beta01'
    

    可能与 beta01 中添加的以下内容有关:

    约束布局

    • 由于兼容性问题,android:layout_width 和 android:layout_height 恢复为非可选。

    Source

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-05
      • 1970-01-01
      • 2013-07-27
      • 1970-01-01
      相关资源
      最近更新 更多