更改应用程序主题后,材料组件主题对话框按钮变得浮肿 [英] Material Components theme dialog buttons go puffy after changing theme of Application

查看:43
本文介绍了更改应用程序主题后,材料组件主题对话框按钮变得浮肿的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天,我正在尝试安装新的材质组件,其中一部分是您需要更改应用程序的父级以从Theme.MaterialComponents继承.我之所以这样做,是因为我想使用底部导航以产生更好的波纹.但是在那之后,几乎所有应用程序中的按钮都变得更加膨松.

Today I was trying out new material components part of their instalation is that you need to change parent of your app to inherit from Theme.MaterialComponents. So I did it because I wanted to use Bottom navigation with nicer ripple. But after that, almost all buttons in application got puffier.

我应该怎么做才能恢复到先前的状态(右图)?

What should I do to revert to the previous state (image on right)?

左侧是材料版本,右侧是appcompat版本

On left is a material version on right is appcompat version

推荐答案

在研究过程中,我找到了答案,我将其保留在这里,也许会对某人有所帮助.

During research, I found the answer I will leave it here maybe it will help someone.

之所以会这样,是因为他们使用了 style ="attr/buttonBarNegativeButtonStyle" 和Material主题将其覆盖

Reason that they look like this is because they use style="attr/buttonBarNegativeButtonStyle" and Material theme overrides them

要解决此问题,您需要使用Bridge主题而不是 Theme.MaterialComponents.Light

To fix this problem you need to use Bridge theme instead of Theme.MaterialComponents.Light

<style name="Theme.MyApp" parent="Theme.MaterialComponents.Light.Bridge">
    <!-- ... -->
</style>

更多信息: https://github.com/material-components/material-components-android/blob/master/docs/getting-started.md#bridge-themes

这篇关于更改应用程序主题后,材料组件主题对话框按钮变得浮肿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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