简体   繁体   中英

ImageButton Android round Image without square border

When I create a round ImageButton , there is also a transparent square border around the object. It shows wenn I click on the ImageButton in the Graphical Layout of the xml file.

How can I remove this border?

You can set custom background for the button, You can specify two images(rounded) for the two states(pressed and not pressed), so that the only two round shaped images wold cover your image, default rectangular would go. I hope It helps you.

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

I tried with colors, you can use images. You just want to save it in your drowable folder and specify it for the background of button

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM