Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
123 views
in Technique[技术] by (71.8m points)

How to disable Android Navigation at res/navigation/nav_graph.xml

I have deleted the Fragment I created and its layout as I don't need it anymore.

But the Fragment keeps coming back except its layout (that is why I'm getting a missing layout.)

I saw it in the res/navigation/nav_graph.xml. So I decided to delete the whole nav_graph.xml

On my third try, I included the deletion of the following implementation setup:

  • implementation 'androidx.navigation:navigation-fragment:2.3.2'
  • implementation 'androidx.navigation:navigation-ui:2.3.2'

But these two returned as well..

What is the trick of totally deleting them for good?

question from:https://stackoverflow.com/questions/65911475/how-to-disable-android-navigation-at-res-navigation-nav-graph-xml

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Remove the fragment in the activity xml that contains

android:name="androidx.navigation.fragment.NavHostFragment"

And if you still having the navgraph.xml, remove the startDestination property.

So then, select File -> Invalidate Caches/Restart -> Invalidate Cache & Restart


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...