2010-09-27 90 views
5

我用這個選擇代碼爲我的自定義按鈕(simple.xml)的Android,刪除自定義按鈕邊框

<?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我不知道如何刪除邊框。我只想顯示我的圖像不顯示按鈕周圍的邊框。

感謝 alt text

回答

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" 
    /> 

而努力

4

android:background而非android:drawable

+0

我更換機器人:可繪製= 「@繪製/聚焦」 與Android:背景= 「@繪製/聚焦」 ,但我得到強制關閉錯誤。感謝 – Jovan 2010-09-27 11:29:41

+0

在XLM文件我使用: Jovan 2010-09-27 11:30:40

+1

你可以給我代碼嗎?謝謝 – Jovan 2010-09-27 12:02:13