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 に答える