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

[TabLayout] setHeight(or setSize) for TabItem's BadgeDrawable ?

Open
#797 10 comments 0 reactions 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

Hello

How can I set height(or size) for BadgeDrawable in TabLayout ?

```
TabLayoutMediator(view.tabLayout, view.viewPager, TabLayoutMediator.TabConfigurationStrategy { tab, position ->
tab.orCreateBadge.apply {
backgroundColor = Color.parseColor("#db635d")
horizontalOffset = -10
}
tab.text = when (position) {
0 -> "주문 내역"
1 -> "받은 선물"
else -> null
}
}).attach()
```

expected

![Screen Shot 2019-11-28 at 12 02 05 PM](https://user-images.githubusercontent.com/7390633/69773725-f6d43f80-11d6-11ea-9edf-d19806bcd877.png)

but I've got

![Screenshot_2019-11-28-14-22-47](https://user-images.githubusercontent.com/7390633/69779238-ac5cbe00-11ea-11ea-9e27-5ce52b1e8c6b.png)

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 TabLayoutMediator and tab.orCreateBadge, then inspect the BadgeDrawable and TabLayout APIs for supported sizing controls. Compare the rendered badge with the supplied screenshots; done means the badge size or height can be configured to produce the expected appearance.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.