-4

how to set alpha at RelativeLayout like this image?

enter image description here

Sirvan
  • 3
  • 2

1 Answers1

0

You can do it both in xml and programatically by using 8-digit color(#AARRGGBB) like this:

android:background="#CC000000"

first two digit is for transparency. for more details look at this link

or you can do it programatically in this way:

View yourRelativeLayout = findViewById(R.id.yourrelativelayout);
Drawable background = yourRelativeLayout.getBackground();
background.setAlpha(85);
kAvEh
  • 534
  • 4
  • 15