Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MaterialButton] maxLines does not work with 99% of inputType #4262

Open
adrianvintu opened this issue Aug 18, 2024 · 0 comments
Open

[MaterialButton] maxLines does not work with 99% of inputType #4262

adrianvintu opened this issue Aug 18, 2024 · 0 comments

Comments

@adrianvintu
Copy link

adrianvintu commented Aug 18, 2024

Description:

I want to display a MaterialButton containing a multi line string, formatted as android:inputType="textCapSentences".

The text is not rendered multi line, only single line. Even though android:maxLines="10" is set.

This android:inputType="textMultiLine" works, but this android:inputType="textMultiLine|textCapSentences" will ignore textCapSentences. Other inputTypes are ignored as well.

Expected behavior:

The text in the button is rendered multi line, while formatting as textCapSentences.

Workaround:
Set max lines in code.

This btn.setMaxLines(10) renders multiline, with textCapSentences formatting. But not if maxLines only set in XML.

Source code:

<com.google.android.material.button.MaterialButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textCapSentences"
android:maxLines="10"
android:text="test\nmultiple\lines" />

Android API version:
21+

Material Library version:

Both versions experience the same behavior.
1.12.0
1.13.0-alpha05

Device:

Emulator 30

To help us triage faster, please check to make sure you are using the latest version of the library.

We also happily accept pull requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants