How to have a transparent ImageButton: Android

后端 未结 19 1986
庸人自扰
庸人自扰 2020-11-27 08:56


        
19条回答
  •  天涯浪人
    2020-11-27 09:30

    Remove this line :

    android:background="@drawable/transparent">
    

    And in your activity class set

    ImageButton btn = (ImageButton)findViewById(R.id.previous);
    btn.setAlpha(100);
    

    You can set alpha level 0 to 255

    o means transparent and 255 means opaque.

提交回复
热议问题