首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >@style/Widget.Material3.Button导致呈现问题

@style/Widget.Material3.Button导致呈现问题
EN

Stack Overflow用户
提问于 2022-10-19 13:51:53
回答 2查看 112关注 0票数 0

当我将样式应用到我的按钮@style/Widget.Material3.Button时,它将使整个布局设计消失,布局不再可见。

这是我的XML代码。

代码语言:javascript
运行
复制
<Button
    style="@style/Widget.Material3.Button"
    android:id="@+id/button"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginStart="60dp"
    android:layout_marginTop="16dp"
    android:layout_marginEnd="60dp"
    android:text="Text"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/textField" />

有什么办法解决这个渲染问题吗?

EN

回答 2

Stack Overflow用户

发布于 2022-10-19 14:23:30

对于材料样式,您需要使用材料组件。com.google.android.material.button.MaterialButton

票数 0
EN

Stack Overflow用户

发布于 2022-10-28 16:24:16

转到主题并将样式的父元素更改为:

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74126592

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档