Material-components-android: Badge overlaps text

Created on 29 Jul 2019  路  5Comments  路  Source: material-components/material-components-android

A badge overlaps a text. How can I prevent it? I don't see any attributes for setting padding /margin.

Code:
val badge = tab_layout.getTabAt(0)?.orCreateBadge?.apply { backgroundColor = requireContext().getColor(R.color.badge_color) } badge?.isVisible = true badge?.number = 4

XML
` app:tabSelectedTextColor="@color/colorPrimary"
style="@style/Widget.MaterialComponents.TabLayout.Colored"
android:background="@color/colorPrimaryDark"
android:id="@+id/tab_layout"
app:tabIndicatorColor="@color/colorPrimary"
app:tabTextColor="#FF757575"
android:layout_height="wrap_content">

    <com.google.android.material.tabs.TabItem android:layout_width="wrap_content"
                                              android:text="@string/recent_edits"
                                              android:layout_height="wrap_content"/>

    <com.google.android.material.tabs.TabItem android:layout_width="wrap_content"
                                              android:text="@string/recent_events"
                                              android:layout_height="wrap_content"/>

</com.google.android.material.tabs.TabLayout>`

Android API: >23

Material Library version:
'com.google.android.material:material:1.1.0-alpha08'

Device: Samsung S9 and others

device-2019-07-29-171236

bug

Most helpful comment

Changes have been submitted internally and should be synced out in the next release.

All 5 comments

Thank you for reporting the issue, we worked with our design team to prototype a change so it will overlap less content. Some content overlapping is intentional because design wants a strong association between the badge and its anchor (label or icon).

@wcshi
When can we see the changes?

@wcshi I am also interested if you could provide an ETA on this one! Thanks!

Prototyping is actively on going.

Changes have been submitted internally and should be synced out in the next release.

Was this page helpful?
0 / 5 - 0 ratings