How to set transparent background for Image Button in code?

前端 未结 7 607
醉话见心
醉话见心 2020-12-25 09:03

I can set ImageButton background transparent in layout.xml using:

android:background=\"@android:color/transparent\"

How I can

7条回答
  •  情深已故
    2020-12-25 09:54

    This is the simple only you have to set background color as transparent

        ImageButton btn=(ImageButton)findViewById(R.id.ImageButton01);
        btn.setBackgroundColor(Color.TRANSPARENT);
    

提交回复
热议问题