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

[Buttons] Max-width of buttons from component source code is not being respected

Open
#4,102 5 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Widget: Button
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

**Description:**

According to the source code Material buttons should be `320dp` maximum by default but this not actually working.

This causes warnings in Android Studio.

image

https://github.com/material-components/material-components-android/blob/release-1.11/lib/java/com/google/android/material/button/res/values/dimens.xml#L20

https://github.com/material-components/material-components-android/blob/release-1.11/lib/java/com/google/android/material/button/res/values/styles.xml#L39

The warning can be suppressed with `tools:ignore="VisualLintButtonSize"` but it would be better to fix the component to behave as specified in the source.

**Material Library version:**
1.11

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 lib/java/com/google/android/material/button/res/values/dimens.xml and styles.xml at the linked lines, then reproduce the Android Studio VisualLintButtonSize warning with Material Library 1.11. Trace why the declared 320dp maximum is not applied; done means buttons respect that maximum by default without requiring tools:ignore="VisualLintButtonSize".

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.