使用MaterialButton的问题

立青_ 中级 2021-05-20 03:08:02
使用MaterialButton,图标显示不出来,不知道咋回事,但位置是占着的,文字偏移了,并且设置iconTint也确实显示颜色了,但图标就死活不出来。

  <com.google.android.material.button.MaterialButton
android:theme="@style/Theme.MaterialComponents.Light.NoActionBar"
app:iconGravity="textStart"
android:textColor="#333"
app:iconPadding="10dp"
app:strokeColor="#ccc"
app:strokeWidth="1dp"
app:cornerRadius="0dp"
app:iconTint="@color/text_color"
android:textSize="16dp"
app:iconSize="22dp"
app:icon="@drawable/ic_launcher"/>
...全文
22053 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
立青_ 中级 2021-05-21
  • 打赏
  • 举报
回复
奇了怪了,昨天设置iconTint就是一团颜色,今天设置iconTint 图标就出来了,我啥也没改啊。而且我图标明明是黑色,到这里就成白色了,我把backgroundTint修改一下,图标就显示出来了。把iconTintMode设置成multiply,图标也能显示出来
初学者-Study 2021-05-21
  • 打赏
  • 举报
回复
和你的图片有关系,调整图片的大小再试试。
Alrey_ 2021-05-21
  • 打赏
  • 举报
回复
style="@style/Widget.MaterialComponents.Button.TextButton.Icon" style="@style/Widget.MaterialComponents.Button.OutlinedButton.Icon" style="@style/Widget.MaterialComponents.Button.Icon" 试试这个

80,469

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧