Android Navigation View Transparency
Solution 1:
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
Solution 2:
If you want transparency with a color try this..
NavigationViewnavigationView= (NavigationView) findViewById(R.id.nav_view);
ViewheaderView= navigationView.getHeaderView(0);
------
// you can even change only one from above to and keep the other one normally
navigationView.getBackground().setColorFilter(0x80000000, PorterDuff.Mode.MULTIPLY);
headerView.getBackground().setColorFilter(0x80000000, PorterDuff.Mode.MULTIPLY);
Output:
If you need more deatals about which colour codes you can apply check my answer here
Or if you only want to set alpha use navigationView.getBackground().setAlpha(intNumberTill256);
p.s Nav headder dark colour is due to it's background colour that i have given in its XML
Solution 3:
To make navigation view completely transparent, this worked for me.
android:background="@android:color/transparent"
Solution 4:
To make transparent for navigation , please try below code
finalWindowwindow= getWindow();
ObjectAnimator animator = ObjectAnimator.ofInt(window,
"navigationBarColor", window.getNavigationBarColor(), Color.TRANSPARENT);
animator.setEvaluator(new ArgbEvaluator());
animator.setDuration(0);
animator.start();
Post a Comment for "Android Navigation View Transparency"