如何将materialButton图标设置在中心 [英] how to set materialButton icon to the center

查看:85
本文介绍了如何将materialButton图标设置在中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 supportLibrary ="28.0.0-beta01" 版本.
这是我在.xml文件中的代码:

I am using supportLibrary = "28.0.0-beta01" version.
Here is my code in .xml file:

<android.support.design.button.MaterialButton
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:icon="@drawable/ic_my_orders"
    app:iconGravity="textStart"
    android:gravity="center"/>

到我的代码图标位于按钮左侧的可绘制位置.我想将按钮设置在中间. 我想达到这个结果

To my code icon of the drawable locating left side of the button. I want to set button to the center. I want to achieve this result

我不需要任何自定义视图或硬编码的东西.如果是bug(app:iconGravity),我将等待下一个版本.

I don't need to any custom views or hard coded things. If this is a bug (app:iconGravity), I will wait next release.

28.0.0-rc01 版本中修复的错误,只需更改版本即可.

The bug fixed in the version 28.0.0-rc01,just change the version.

推荐答案

原始问题中的代码段是正确的.该漏洞已被识别为漏洞,并将在即将发布的版本中修复.

The code snippet you have in your original question is correct. This has been identified as a bug and will be fixed in the upcoming release.

这篇关于如何将materialButton图标设置在中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆