material-components-android
material-components-android copied to clipboard
[MaterialButton] maxLines does not work with 99% of inputType
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.