com.google.android.material.button.MaterialButton "OutlinedButton" 样式 Android
com.google.android.material.button.MaterialButton "OutlinedButton" style in Android
我用过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" />
将 app:backgroundTint="@color/white"
用于您的 MaterialButton
我用过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" />
将 app:backgroundTint="@color/white"
用于您的 MaterialButton