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

[Button] Why does the MaterialButton display text in two lines instead of one?

Open
#3,586 2 comments 0 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

I'm using com.google.android.material.button.MaterialButton as a button :

```

```
As you can see, **OPEN GALLERY** is breaking into two lines instead of staying on a single line. The `MaterialButton's `width is set to fill the entire screen, but it doesn't seem to be considering this.

![image](https://github.com/material-components/material-components-android/assets/24398682/df0af42e-7452-4a57-950a-6995f8bcc8a2)

What I want is :

![image](https://github.com/material-components/material-components-android/assets/24398682/cf5999aa-d87a-4526-87dd-1409d64777ab)

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 by reproducing the MaterialButton XML configuration shown in the issue, focusing on its width, text size, icon, and available screen space. Determine whether the two-line label is expected for this configuration or reveals a component bug; completion requires a verified explanation or a narrowly defined fix and regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
android
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.