【问题标题】:Extra space on top and bottom of android Chip material componentandroid芯片材料组件顶部和底部的额外空间
【发布时间】:2020-06-04 12:09:00
【问题描述】:

我在我的布局中使用 Chip 视图
由于将材料设计组件从1.0.0升级到1.1.0topbottom多了一个空间强> 观点
我找不到任何有关如何删除这些空格的文档

在材料 1.0.0

在材料 1.1.0

<com.google.android.material.chip.Chip
    style="@style/Widget.MaterialComponents.Chip.Action"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintBottom_toBottomOf="parent"
    android:text="Groceries"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

【问题讨论】:

  • 您可以将代码添加为 TEXT 而不是图像吗?

标签: android material-design android-view material-components-android android-chips


【解决方案1】:

chipMinTouchTargetSize属性有关。
你可以在Chipsource code找到:

if (shouldEnsureMinTouchTargetSize()) {
  setMinHeight(minTouchTargetSize);
}

您可以在布局或样式中更改chipMinTouchTargetSize

    <com.google.android.material.chip.Chip
        app:chipMinTouchTargetSize="32dp"
        ../>

或者你可以设置app:ensureMinTouchTargetSize="false"

注意更改此值,因为它会更改最小触摸目标大小。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-25
    • 2016-12-18
    • 1970-01-01
    • 2018-08-16
    • 2020-04-18
    • 2017-08-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多