Is your feature request related to a problem? Please describe.
Up until release 1.1.0-alpha06 back in May 2019, the only way to change the icon position was done using TextViewCompat.setCompoundDrawablesRelative.
After introducing new method setIconGravity in release 1.1.0-alpha06 it was finally possible to properly set the icon position, although only on the right or left, and close to the text or not.
This now excludes the possibility to place the icon either on top or bottom relative to the text.
Describe the solution you'd like
Please kindly add TOP & BOTTOM gravity as part of @IconGravity.
Describe alternatives you've considered
As said at the beginning, before release 1.1.0-alpha06, the only way to change the icon position was using TextViewCompat.setCompoundDrawablesRelative.
This no longer works, as it triggers a requestLayout which, at some point, will trigger updateIconPosition and then updateIcon where only START/TEXT & END/TEXT are supported.
It is not a bad idea but currently the material guideline specs are against this scenario.
At some point here: https://material.io/components/buttons/#contained-button
You will find this image:

Which exactly cover this case
Actually, in Gmail, there are buttons which have the icon on the left, but when insufficient width is there, they push the icon on the top. Seems pretty useful.


Actually, in Gmail, there are buttons which have the icon on the left, but when insufficient width is there, they push the icon on the top. Seems pretty useful.
Agree 100%, I think it is a useful feature
Actually, in Gmail, there are buttons which have the icon on the left, but when insufficient width is there, they push the icon on the top. Seems pretty useful.
Agree 100%, I think it is a useful feature
Yes this is exactly the point. The project's lead designer just told me "top icon is required to provide more flexibility with the text".
We got approval from design to support adding gravity Top. However we'll leave the guideline in material.io since it should be only for edge cases
That's great news ! Thanks. When could I expect the support ?
Any news on this feature?
Bump
Can you make it available on the next alpha version?
I've sent a PR adding top gravity only, let's wait if it is approved!
any update of this gravity top? 鈽癸笍
@ymarian do you know if the designers changed their mind about aligning icon on top? My PR was merged and then rollbacked.
It was rolled back due to internal breakages, we are still trying to fix them so we can roll the change forward.
Let me know if I can help with any changes.
@ymarian can we close this issue?
Finally landed in b39845a452f547d5844996074ac9aabe911d637f. Thanks @rewgoes!
Is it available for use now in any of the versions?
@karanjhinga Not yet, no. It should be in the next 1.3.0-alpha02 release
@karanjhinga you can use the snapshot release
Most helpful comment
I've sent a PR adding top gravity only, let's wait if it is approved!