【问题标题】:Android Kotlin Can we put combination of text and image icon to the checkbox?Android Kotlin 我们可以将文本和图像图标的组合放在复选框中吗?
【发布时间】:2020-12-12 23:23:35
【问题描述】:

制作了只有文字的浇头复选框,想知道我可以在其中添加一个小图片。

<CheckBox
        android:id="@+id/checkWhippedCream"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="16dp"
        android:paddingStart="24dp"
        android:paddingEnd="24dp"
        android:text="@string/whipped_cream"
        android:textSize="16sp" />

【问题讨论】:

    标签: android kotlin checkbox radio-button


    【解决方案1】:

    是的,您可以使用android:drawableEnd(可以是任何一侧:底部、顶部、开始、结束)

    <CheckBox
        android:id="@+id/checkWhippedCream"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="16dp"
        android:paddingStart="24dp"
        android:paddingEnd="24dp"
        android:text="@string/whipped_cream"
        android:drawableEnd="@drawabale/your_icon"
        android:textSize="16sp" />
    

    【讨论】:

    • 如何定义它的尺寸?
    • 你不能定义它,你应该使用所需大小的图标
    猜你喜欢
    • 1970-01-01
    • 2021-07-23
    • 1970-01-01
    • 2015-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-10
    • 1970-01-01
    相关资源
    最近更新 更多