Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FragmentNavigator add Fragment instead of replace for transparent background

When using the Navigation library from AndroidX, I'd like to display a Fragment with a semi-transparent background on top of the old destination. So basically, instead of the FragmentNavigator doing ft.replace(mContainerId, frag) inside its navigate() method, having a ft.add(mContainerId, frag) instead.

I've tried subclassing FragmentNavigator, but the API is very strongly limited (lots of private variables and package protected methods), thus not being able to properly override the navigate() method in order to make that change.

So, what would be the correct method to achieve support for Fragments with transparent background using the Navigation library?

like image 870
Bogdan Zurac Avatar asked Apr 01 '19 10:04

Bogdan Zurac


1 Answers

If what you are looking for is Dialog, then it is now fully supported as of 2.1.0-alpha03

You can achieve your intended behavior with dialog destination which will show on top of your current destination.

like image 92
musooff Avatar answered Oct 29 '22 21:10

musooff