I need to create a semi-transparent ImageButton but I haven’t find a valid way to do this.
How to set a SemiTransparent look and feel with a settable transparency level?
Any suggestion?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can adjust the button transparency level with this code.
mybutton.getBackground().setAlpha(45);The number 45 value here ranges from 0 – 255
If you are using a .ninePatch.png file you can obviously reduce the opacity of the button via your image editing software and save it and use it in your xml.
Tip: Semi transparent buttons indicate a button is disabled. According to android design guidelines. So use it wisely.
You can set a button disabled by
myButton.setEnabled(false);