CodeFury
CodeFury

Reputation: 1540

setAlpha(int a) not working when used inside a thread

I am trying to change the view Alpha using setAlpha(int a) method, but it has no effect and also tried to perform alpha animation on same but the same result!. Please help. Here is the part of code..

public void run() {
            runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        myImage.setAlpha(1);
                    }
                });

        }

Upvotes: 2

Views: 9239

Answers (2)

Nikhil Chaurasiya
Nikhil Chaurasiya

Reputation: 123

Try this:

myImage.getBackground().setAlpha(100);

Upvotes: 2

DuneCat
DuneCat

Reputation: 788

I don't know which values you've tried using, but the method takes values from 0 to 255, where 255 is completely opaque, as per this answer.

Upvotes: 9

Related Questions