5

我将此选择器代码用于我的自定义按钮(simple.xml)

  <?xml version="1.0" encoding="utf-8"?>

  <selector xmlns:android="http://schemas.android.com/apk/res/android">
      <item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/focused" />
      <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/focusedpressed" />
      <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/pressed" />
      <item android:drawable="@drawable/defaultbutton" />
  </selector>

但在我的 ImageButton 上,我不知道如何删除边框。我只想显示我的图像而不显示按钮周围的边框。

谢谢 替代文字

4

2 回答 2

6

我替换

    <ImageButton android:id="@+id/imagebutton"
  android:src="@drawable/simple"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  />

和 :

    <ImageButton android:id="@+id/imagebutton"
  android:background="@drawable/simple"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  />

和工作

于 2010-09-27T12:09:39.653 回答
4

设置android:background而不是android:drawable.

于 2010-09-27T11:10:05.840 回答