Y
Y
Yuri2017-11-03 18:17:49
Android
Yuri, 2017-11-03 18:17:49

How to make a Bordless button with a given background color?

I need a button without padding with a given background color and a working "default" ripple effect:
u8CR3.png
I tried to do this:

<Button
            style="@style/Button.Default"
            android:id="@+id/next"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="@string/continue_text"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"/>

styles.xml:
<style name="Button.Default" parent="Widget.AppCompat.Button.Borderless.Colored">
        <item name="colorButtonNormal">@color/accent</item>
        <item name="android:textColor">@android:color/white</item>
</style>

I got the following:
QPvxy.png
Plus, when I click, I see a highlight with indents:
nU65v.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question