Android Material Chip Margin Spacing in ChipGroup

If you add multiline Chip dynamically to ChipGroup until it expand to multiple rows, there is zero margin vertical margin.

Set app:chipSpacingVertical on ChipGroup to enable margin spacing.

<com.google.android.material.chip.ChipGroup
    android:id="@+id/mainTagChipGroup"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:chipSpacingVertical="4dp"
    />

NOTE: You can set app:chipSpacingHorizontal or app:chipSpacing as well.

NOTE: Strangely, default margin for static Chip defined in xml vs dynamic Chip added programatically is different. I am using com.google.android.material:material:1.1.0-alpha04.

NOTE: Setting layoutParams on Chip doesn't work.

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.