我想定制一个Material芯片。
我认为这是如何做到的:
<style name="AppTheme" parent="Theme.MaterialComponents.NoActionBar">
.... lots more theme stuff here
<item name="chipStyle">@style/MaterialChips</item>
<item name="chipGroupStyle">@style/MaterialChips</item>
<item name="chipStandaloneStyle">@style/MaterialChips</item>
</style>
<style name="MaterialChips" parent="Widget.MaterialComponents.Chip.Choice">
<item name="chipBackgroundColor">@color/chips</item>
</style>
Run Code Online (Sandbox Code Playgroud)
像这样的标签都不会chipStyle影响芯片。但如果我app:chipBackgroundColor="@color/chips"在 xml 中设置它就可以了。
对于其他事情,比如 say ,它也可以很好地工作<item name="materialAlertDialogTheme">@style/AlertDialogTheme</item>。
材料文档(如果你可以这样称呼它的话)确实没有帮助。
android material-design android-chips material-components material-components-android