如何解决com.google.android.material.button.MaterialButton Android 中的“OutlinedButton”样式
我已经使用了 MaterialButton,但我期望的设计没有出现。在我的 xml 代码和样式下面。
我需要背景的白色而不是橙色,我可以做些什么来实现这一点。请提供您的建议。
// Material Design version I've used
implementation 'com.google.android.material:material:1.2.1'
**Color primary** means orange color.
<com.google.android.material.button.MaterialButton
android:id="@+id/btnWatchVideo"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/watch_video"
android:textColor="@color/colorBlack"
android:visibility="visible"
app:strokeColor="@color/colorBlack"
app:strokeWidth="2dp" />
<style name="SliderThemeBlack" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorBlack</item>
<item name="colorAccent">@color/colorPrimary</item>
<item name="android:screenorientation">portrait</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
Manifest:
<activity android:name="xxx"
android:theme="@style/SliderThemeBlack" android:windowSoftInputMode="stateHidden" />
解决方法
对您的 MaterialButton 使用 app:backgroundTint="@color/white"
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。