I have a ListView , and the list item has a round button.

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:

enter image description here

How can you make the button remain round even when you click on an element?

    1 answer 1

     <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="false"> <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> <item android:state_pressed="true"> <shape android:shape="rectangle"> <size android:height="@dimen/task_list_parent_indicator" android:width="@dimen/task_list_parent_indicator" /> <solid android:color="#любой другой цвет" /> <corners android:radius="@dimen/tool_bar_button_radius" /> <stroke android:width="0.1dp" android:color="@color/colorAccent" /> </shape> </item> </selector> 

    But it is better to separate the logic of the state \ figure