【问题标题】:Is android:drawableStart in androidx.appcompat.widget.AppCompatButton supported by android 4.4?android 4.4 是否支持 androidx.appcompat.widget.AppCompatButton 中的 android:drawableStart?
【发布时间】:2021-09-10 01:31:52
【问题描述】:
<androidx.appcompat.widget.LinearLayoutCompat
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/Black"
    android:orientation="horizontal">

    <androidx.appcompat.widget.AppCompatButton
        android:id="@+id/buttonFoo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:drawableStart="@drawable/ic_foo_icon"
        android:drawablePadding="8dp"
        android:text="@string/foo" />
/androidx.appcompat.widget.LinearLayoutCompat>

上面的activity布局在Activity启动时会在Android 4.4上导致如下异常:

android.view.InflateException: Binary XML file line #123: Error inflating class <unknown>

它只发生在 Android 4.4 上。所有其他设备都很好。
如果删除以下内容,一切都会好起来的:

android:drawableStart="@drawable/ic_foo_icon"

androidx.appcompat.widget.AppCompatButton 中的 android:drawableStart 是否被 android 4.4 支持?

【问题讨论】:

    标签: android-button androidx android-4.4-kitkat


    【解决方案1】:

    为什么不使用 drawableLeft / drawableRight 呢?

    【讨论】:

    • 感谢您的帮助。 drawableLeft / drawableRight 有同样的问题。
    猜你喜欢
    • 2010-12-16
    • 2015-01-03
    • 2018-03-26
    • 2016-12-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-27
    • 1970-01-01
    相关资源
    最近更新 更多