Show circle over back button on action bar

897 Views Asked by At

I have a custom action bar. I create action bar layout with button and TextView. I want, when user press back button, change view of back button. like gmail app that user click on back button, a rectangle shows over back button but I want shows circle over back button. I want to link images but I have not allow.

I don't know how can calculate radius of circle for any size of devices. Thanks for advises and sorry for my poor english.

1

There are 1 best solutions below

0
On BEST ANSWER

The easiest way is to do two different icons one with circle around and another one without it. Then you won't have any problem with the sizes of devices.

You can do it with a selector like this:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:state_pressed="true" android:drawable="@drawable/your_icon_with_circle"/>
    <item android:drawable="@drawable/your_icon_without_circle" />
</selector>

And then you can set the selector into the button background