工具栏的setupWithNavController方法不再可用? [英] setupWithNavController method for toolbar no longer available?
本文介绍了工具栏的setupWithNavController方法不再可用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以以前我曾因错误而崩溃:
在调用getGraph()之前必须先调用setGraph()
然后阅读解决方案框架
解决方案
要使用任何 NavigationUI Kotlin扩展功能,必须使用依赖项的 -ktx
版本。
实现 androidx.navigation:navigation-fragment-ktx:2.3.0-alpha02
实现 androidx.navigation:navigation-ui-ktx:2.3.0-alpha02
so previously I had crash with error:
You must call setGraph() before calling getGraph()
then after reading the solution frem here. it is said that I have to use these lines on my gradle
implementation "androidx.navigation:navigation-fragment:2.3.0-alpha02"
implementation "androidx.navigation:navigation-ui:2.3.0-alpha02"
and the error is dissapear. but now I no longer can find setupWithNavController
method. usually I use this line
toolbar.setupWithNavController(navController,appBarConfiguration)
but I no longer find that method. what should I do ?
解决方案
To use any of the NavigationUI Kotlin extension functions, you must use the -ktx
version of the dependencies.
implementation "androidx.navigation:navigation-fragment-ktx:2.3.0-alpha02"
implementation "androidx.navigation:navigation-ui-ktx:2.3.0-alpha02"
这篇关于工具栏的setupWithNavController方法不再可用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文