相关疑难解决方法(0)

Material Design 组件按钮全局主题覆盖损坏

我想简单地将样式应用到这样的主题级别上的所有按钮

<style name="BaseTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
     ...    
    <item name="buttonStyle">@style/DefaultButton</item>
</style>

<style name="DefaultButton" parent="Widget.MaterialComponents.Button">
    <item name="android:textColor">@color/whatever</item>
</style>

<Button
    android:id="@+id/addChannelButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|center_horizontal"
    android:layout_margin="16dp"
    android:text="Add room" />
Run Code Online (Sandbox Code Playgroud)

为什么这不起作用?它会在 appcompat

// 如果我使用Theme.MaterialComponents.Light.NoActionBar.Bridge,那么它有效

android android-button material-design material-components material-components-android

2
推荐指数
1
解决办法
2468
查看次数