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

[MaterialButton] loss of functionality when going from android Button to MaterialButton.

Open
#599 2 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description:
There is functionality lost when converting a project from using Android buttons to MaterialButtons. The loss of functionality is in how button icons can be placed. The following buttons properties do work properly. These can also be used to have multiple icons on a single button.

  • android:drawableStart
  • android:drawableLeft
  • android:drawableTop
  • android:drawableEnd
  • android:drawableRight
  • android:drawableBottom
  • android:drawablePadding - Including this option since it is tied to the rest of the options which appear to be ignored.

Expected behavior: For the icons on the MaterialButton version to match the icon placement as shown by the Android Button version.

Source code:
I have a sample project created showing the bug. All that is different is that
https://github.com/kphillisjr/MaterialButtonDrawableBug

Android API version: 15

Material Library version:
Versions that run: com.google.android.material:material:1.0.0
Version that does not run ( fails due to theme enforcement problems): com.google.android.material:material:1.1.0-alpha10

Device:
android Emulator x86 - android 4.4 without google APIs
android Emulator x86 - Android 8.0.0 with google API installed

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

Use the linked MaterialButtonDrawableBug sample project to reproduce the issue on the stated Android API versions and compare MaterialButton with the Android Button. Investigate handling for drawableStart, drawableLeft, drawableTop, drawableEnd, drawableRight, drawableBottom, and drawablePadding in the MaterialButton implementation. Done means the MaterialButton places icons like the Android Button, including multiple icons and padding.

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
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.