2016-06-25 18 views
0

你好,我需要一些幫助來創建Imagebutton。我在PS上創建了自定義按鈕,然後以透明背景將其保存爲PNG格式。之後,我用9patch修補了我的圖片。現在,我在該佈局中將該圖像用作按鈕,但該圖像顯示彩色背景角落。我嘗試了很多東西,但沒有刪除。ImageButton Border Transparancy - 刪除圓形圖像的方形邊框不起作用?

Here is my image

這裏是我的XML

<ImageButton 
    android:id="@+id/mybutton" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="@android:color/transparent" 
    android:src="@drawable/registerbutton" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentRight="true" 
    android:layout_alignParentEnd="true" 
    android:layout_marginBottom="123dp" /> 

Here is the image of imagebutton It shows white corners

回答

0

保持背景屬性作爲@null這樣的按鈕在線:

android:background="@null" 

如果仍然您獲得的角落,它可能是從PNG文件您正在使用。

這是我從@null

enter image description here

+0

感謝您的幫助。我只是檢查了從9patching輸出的角落。 –

0

可能是 「9patching」 操作的輸出中添加的角落。打開文件並檢查是否有轉角。 如果贏了,請嘗試使用android:background屬性切換android:src屬性。

+0

感謝您的幫助得到一個例子。我剛剛檢查了從9patching輸出的角落 –

+0

接受正確的答案:) –

0

和U可以使用png格式this site

+0

謝謝它真的有幫助。 –