首页 > 解决方案 > Material Components 主题渲染 TextButton 不正确

问题描述

在按照开始更新我们的 Android 应用程序以继承自的说明进行操作后Theme.MaterialComponents.Light,纯文本按钮呈现不正确。

在注释中,文档状态:

Note: Using a Material Components theme enables a custom view inflater 
which replaces default components with their Material counterparts. 
Currently, this only replaces <Button> XML components with 
<MaterialButton>.

有没有办法禁用自定义视图充气或解决按钮问题?

在此处输入图像描述

标签: javaandroidmaterial-designandroid-themematerial-components

解决方案


自定义充气器仅替换没有限定符的名称,因此您可以在需要使用特定视图时使用完整的限定名称。在您的情况下<Button>,用<android.widget.Button>xml 替换。


推荐阅读