Answer the question
In order to leave comments, you need to log in
How to round buttons?
I want to make all standard buttons have a rounding through styles.xml
But there are a lot of buttons with different colors, the solutions that I found require that each button style has its own file in the drawable?
Answer the question
In order to leave comments, you need to log in
<style name="AppTheme" parent="YourTheme">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="materialButtonStyle">@style/systemButtonStyle</item> <!-- если используете MaterialComponents -->
<item name="buttonStyle">@style/systemButtonStyle</item> <!-- если используете AppCompat -->
</style>
<style name="systemButtonStyle" parent="Widget.MaterialComponents.Button">
<item name="android:background">@drawable/roundedbutton</item>
</style>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ff0000" />
<corners android:radius="8dp"/>
</shape>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question