Android 材料设计、排版和小吃条
根据,我一直在通过修改textAppearanceX属性来定制我的应用程序的样式。有人知道要自定义哪个属性来设置应用程序的snackbar的样式,或者在哪里记录了这些属性吗Android 材料设计、排版和小吃条,android,material-design,android-theme,android-snackbar,material-components-android,Android,Material Design,Android Theme,Android Snackbar,Material Components Android,根据,我一直在通过修改textAppearanceX属性来定制我的应用程序的样式。有人知道要自定义哪个属性来设置应用程序的snackbar的样式,或者在哪里记录了这些属性吗 谢谢。使用材质组件库,您可以通过应用程序主题自定义文本和按钮使用的文本外观: 只需使用snackbarButtonStyle和snackbarTextViewStyle属性在应用程序中全局定义: <style name="AppTheme" parent="Theme.MaterialComponents.*">
谢谢。使用材质组件库,您可以通过应用程序主题自定义文本和按钮使用的
文本外观
:
只需使用snackbarButtonStyle
和snackbarTextViewStyle
属性在应用程序中全局定义:
<style name="AppTheme" parent="Theme.MaterialComponents.*">
<!-- Style to use for action button within a Snackbar in this theme. -->
<item name="snackbarButtonStyle">@style/Custom.TextButton.Snackbar</item>
<!-- Style to use for message text within a Snackbar in this theme. -->
<item name="snackbarTextViewStyle">@style/Custom.Snackbar.TextView</item>
....
</style>
这只是一个例子:
<style name="snackbar_button_textappearance" parent="@style/TextAppearance.MaterialComponents.Button">
<item name="android:textStyle">italic</item>
</style>
斜体
对于文本,您可以执行类似的操作:
<style name="Custom.Snackbar.TextView" parent="@style/Widget.MaterialComponents.Snackbar.TextView">
<item name="android:textAppearance">......</item>
</style>
......
请注意:
属性需要版本1.1.0snackbarButtonStyle
属性需要版本1.2.0snackbarTextViewStyle
文本外观
:
只需使用snackbarButtonStyle
和snackbarTextViewStyle
属性在应用程序中全局定义:
<style name="AppTheme" parent="Theme.MaterialComponents.*">
<!-- Style to use for action button within a Snackbar in this theme. -->
<item name="snackbarButtonStyle">@style/Custom.TextButton.Snackbar</item>
<!-- Style to use for message text within a Snackbar in this theme. -->
<item name="snackbarTextViewStyle">@style/Custom.Snackbar.TextView</item>
....
</style>
这只是一个例子:
<style name="snackbar_button_textappearance" parent="@style/TextAppearance.MaterialComponents.Button">
<item name="android:textStyle">italic</item>
</style>
斜体
对于文本,您可以执行类似的操作:
<style name="Custom.Snackbar.TextView" parent="@style/Widget.MaterialComponents.Snackbar.TextView">
<item name="android:textAppearance">......</item>
</style>
......
请注意:
属性需要版本1.1.0snackbarButtonStyle
属性需要版本1.2.0snackbarTextViewStyle