【发布时间】:2016-09-24 16:02:00
【问题描述】:
我试图获得一个圆形的图像按钮。但它显示的是带有方形背景的圆形图像,但我只需要没有任何背景的图像。 我还使用round_image.XML 作为背景可绘制文件,但它不起作用。
menu.xml
<ImageButton
android:id="@+id/imageButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:src="@drawable/sliderr" android:background="@drawable/round_image"/>
round_image.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"android:shape="oval">
<gradient android:startColor="#50d050
android:endColor="#008000" android:angle="270"/>
<stroke
android:width="1px"
android:color="#000000"/>
</shape>
【问题讨论】:
-
是的!但我没有使用按下状态和焦点。我试过使用选择器。
标签: android-studio android-imagebutton