Android Stroke Around 来自 Style 的 Material Button

标签 android material-design

尝试显示轮廓按钮,如 material design docs 中所述.我能做的最好的结果是一个简单的文本按钮(具有透明背景和无边框的文本)。我错过了什么?

<style name="PrimaryOutlinedButton" parent="Widget.MaterialComponents.Button.OutlinedButton">
    <item name="android:strokeColor">@color/blue</item>
    <item name="android:strokeWidth">4</item>
    <item name="android:textSize">14sp</item>
</style>

最佳答案

查看源代码后,我认为您应该删除“android:”限定符,因为新 Material 参数在原始样式中不可用。

参见:https://github.com/material-components/material-components-android/blob/master/lib/java/com/google/android/material/button/res/values/styles.xml#L73

关于Android Stroke Around 来自 Style 的 Material Button,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53464050/

相关文章:

Android 如何去除文字阴影?

css - 如何解决 mat-datepicker-toggle 位置问题?

material-design - Jhipster/md-button 不是已知元素

javascript - 如何构建自定义material-ui组件

android - Material 对话框更改文本大小

android - 新 Android 项目中缺少 main.xml - Eclipse OS X

android : Identifiers must have user defined types from the XML file. v 丢失了

android - MoPub 原生广告和 Facebook“未发现广告”

java - API 级别 8 的 NoClassDefFoundError

javascript - 您在上下文中提供了一个没有主题的函数。父元素之一需要使用 ThemeProvider