java - 材料设计在android studio中不起作用
问题描述
我
implementation 'com.google.android.material:material:1.0.0'
在 Build.gradle添加了以下依赖项
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="36dp"
android:layout_marginTop="88dp"
android:background="@drawable/ic_launcher_background"
android:text="Click Me"
android:textColor="@color/colorAccent"
android:textSize="15sp"
app:backgroundTint="#00FFFFFF"
app:iconTint="@color/colorAccent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:strokeColor="@color/colorAccent"
/>
常规按钮已形成,但应该有一个大纲按钮,因为我使用了这种样式:
style=@style/Widget.MaterialComponents.Button.OutlinedButton
选择的最低 Api 是否有任何问题或任何其他问题,请帮助我解决这个问题,谢谢
解决方案
在基本应用程序主题中使用 Material 组件主题作为父级。像下面
<!-- Base application theme. -->
<style name="AppTheme" parent="**Theme.MaterialComponents.Light.NoActionBar**">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
推荐阅读
- jsp - 仅在某些条件下使用 trimDirectiveWhitespaces
- debian - Debian 9 /etc/hosts 文件自动更改
- sas - SASmarkdown 中的直方图不输出为 PDF
- webpack - 构建失败,gulp watch 抛出这个错误
- google-apps-script - 仅了解 Appscript 的定价,而不是我们现有 GCP 的整个 GSuite
- directory - 无法通过 Colab 在 gDrive 中创建目录
- java - 如何在 macOS 上安装 Cassandra?
- arrays - 在 VBS 中对数字数组进行排序
- java - maven-plugin-plugin:3.2:descriptor failed: Index 22273 out of bounds for length 88
- javascript - 如何检查变量是否未定义