MaterialButton 和简单的 Button 之间有什么区别吗? [英] Is any difference between a MaterialButton and a simple Button?

本文介绍了MaterialButton 和简单的 Button 之间有什么区别吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我将Theme.MaterialComponents.Light设置为我的主题,如果我在xml布局中使用这两个按钮会有什么区别吗?

If I set Theme.MaterialComponents.Light as my main theme, will be any difference between these two buttons if I use them in an xml layout?

<Button />

<com.google.android.material.button.MaterialButton />

正如我所见,它们的行为都与 MaterialButton 相同.如果我想获得旧的普通按钮的行为,我必须使用:

As I saw they behave both as MaterialButtons. If I want to get the behavior of the old plain button, I have to use:

<androidx.appcompat.widget.AppCompatButton />

提前致谢!

推荐答案

如果您使用的是 MaterialComponents 主题

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