material-components / material-components/material-components-android

[BadgeDrawable] Support new gravities, such as TOP, START, END and BOTTOM

Open
#2,390 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting Design Feedback feature request Widget: Badge
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

The badge gravity consists of TOP_START, TOP_END, BOTTOM_START and BOTTOM_END currently. But consider a very simple layout, a width-wrap-content text button with an icon on top of the text.

![1632671546991](https://user-images.githubusercontent.com/20295792/134814974-5a988a0f-51db-43f9-abd8-c8ce45d47df5.jpg)

Usually we hope the badge is at the top_end of the icon. But the width of the button is different in different languages because the width of "My Cart" varies. If the badge gravity support TOP ( which means vertically on the top and horizontally in the middle), the badge can be easily positioned with the gravity TOP and some horizontal offset.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with BadgeDrawable, the entry point named in the issue, and trace how TOP_START, TOP_END, BOTTOM_START, and BOTTOM_END are currently handled. Done means TOP, START, END, and BOTTOM can position the badge as requested for varying button widths while retaining horizontal offset support.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.