ImageButton Border Transparency - How do I remove the square border around round image?

前端 未结 3 1568
Happy的楠姐
Happy的楠姐 2020-12-08 06:41

I think my image is transparent, but I am seeing a grey background appearing around the edges of my image which is round. So instead of nice transparent round ImageButton

相关标签:
3条回答
  • 2020-12-08 07:26

    Set this attribute in your ImageButton XML android:background="@null"

    <ImageButton android:src="@drawable/yourimagename"
         android:id="@+id/thebuttonid"
         android:layout_width = "wrap_content"
         android:layout_height = "wrap_content"
         android:background="@null"
         />
    
    0 讨论(0)
  • 2020-12-08 07:30

    Or just set the background to Android's transparent color

    <ImageButton android:src="@drawable/yourimagename"
         android:id="@+id/thebuttonid"
         android:layout_width = "wrap_content"
         android:layout_height = "wrap_content"
         android:background="@android:color/transparent"
         />
    
    0 讨论(0)
  • 2020-12-08 07:30

    You could use ImageButton.setBackgroundResource(int) (android:background attribute) which will get rid of that border.

    Costi

    0 讨论(0)
提交回复
热议问题