M
M
Maybe_V2016-03-27 21:49:31
Android
Maybe_V, 2016-03-27 21:49:31

How to make a completely round button?

I have a ListView and the list item has a round button!
I made it round like this:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <size
                android:height="@dimen/task_list_parent_indicator"
                android:width="@dimen/task_list_parent_indicator"
                />
            <solid
                android:color="@color/colorPrimaryDark"
                />
            <corners
                android:radius="@dimen/tool_bar_button_radius"
                />
            <stroke
                android:width="0.1dp"
                android:color="@color/colorAccent"
                />
        </shape>
    </item>
</selector>

It looks round, but when you click on the element, you can see the square of the button:
79310113e2a44c42bdee5d1c61d433bc.pngHow can I make the button remain round even when the element is clicked ???

Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2016-03-27
@prokopov-vi

You already have a selector , you just need to add a similar item to it with the state_pressed="true" state. There, write how you want the pressed button to look.
To be fair, it's better to use android:shape="oval" instead of a rectangle with rounded corners. Style the height, width and background of the button. Will be ok.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question