Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Navigation View transparency

everyone. Is it possible to make Navigation View transparent? I have custom layout and try to set 50% transparent background for this layout, Navigation View or Drawer Layout.

android:background="#80000000"

but it doesn't give expected result.

Anybody tried to do this? I would appreciate help.

like image 485
Peter Parker Avatar asked Dec 06 '22 15:12

Peter Parker


1 Answers

you can try:

navigationView.getBackground().setAlpha(122);

Here you can set the opacity between 0 (fully transparent) to 255 (completely opaque).

you can also use XML value alpha that takes double values.

The range is from 0f to 1f (inclusive), 0f being transparent and 1f being opaque:

android:alpha="0.0" invisible

android:alpha="0.5" see-through

android:alpha="1.0" full visible

like image 155
rafsanahmad007 Avatar answered Dec 21 '22 22:12

rafsanahmad007