How to Set Opacity (Alpha) for View in Android
Posted
by ncakmak
on Stack Overflow
See other posts from Stack Overflow
or by ncakmak
Published on 2010-05-15T03:04:09Z
Indexed on
2010/05/15
3:14 UTC
Read the original article
Hit count: 1313
I have a button as in the following:
<Button android:text="Submit" android:id="@+id/Button01" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
In my onCreate event, I am calling Button01 like this:
setContentView(R.layout.main);
View Button01 = this.findViewById(R.id.Button01);
Button01.setOnClickListener(this);
There is a background in the application, and I want to set an opacity on this submit button. How can I set an opacity for this view? Is it something that I can set on the java side, or can I set in the main.xml file?
On the java side I tried Button01.mutate().SetAlpha(100)
, but it gave me an error.
Thank you.
© Stack Overflow or respective owner