【问题标题】:Android ImageButton src overwriting backgroundAndroid ImageButton src 覆盖背景
【发布时间】:2014-05-03 18:24:20
【问题描述】:

我正在尝试使用下面的代码创建一个圆形图像按钮,当您不声明 src 图像时该按钮有效。但是,当您这样做时,它只是将图像放入其中,但没有对其进行四舍五入效果。

style.xml

<ImageButton
    android:id="@+id/imageButton2"
    android:layout_width="match_parent"
    android:layout_height="100dp"
    android:layout_below="@+id/imageButton1"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="41dp"
    android:src="@drawable/ellyfish"
    android:background="@drawable/roundcorner"
    />

圆角.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#33DDFF" />        
    <corners android:radius="50dp" />
</shape>

【问题讨论】:

    标签: android imagebutton android-imagebutton


    【解决方案1】:

    将您的src 图片设为圆形,或使其透明,以便您可以看到其背后的圆形背景。

    【讨论】:

      猜你喜欢
      • 2012-07-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-03
      • 2013-02-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多