gpt4 book ai didi

java - 如何修复(错误 : cannot find symbol class ActionOnlyNavDirections) with navigation architecture in Android studio

转载 作者:行者123 更新时间:2023-12-02 05:26:42 25 4
gpt4 key购买 nike

我正在 Android studio 中使用导航架构组件。我将它与底部应用程序栏一起使用,它工作得很好,但是每当我尝试添加操作时,我都会在启动应用程序时收到此错误(错误:找不到符号类“ActionOnlyNavDirections”)

<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/nav_graph"
app:startDestination="@id/Around">

<fragment
android:id="@+id/Around"
android:name="com.Czynt.kazdoura.AroundFragment"
android:label="fragment_around"
tools:layout="@layout/fragment_around">
<action
android:id="@+id/action_Around_to_listView"
app:destination="@id/listView" />

</fragment>
<fragment
android:id="@+id/listView"
android:name="com.Czynt.kazdoura.ListView"
android:label="fragment_list_view"
tools:layout="@layout/fragment_list_view" />
</navigation>

public class AroundFragment extends Fragment{
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
TabItem listTab = getActivity().findViewById(R.id.listTab);
listTab.setOnClickListener(Navigation.createNavigateOnClickListener(R.id.action_Around_to_listView,null));

最佳答案

我更新了 android studio 和我的应用程序中的所有依赖项,它工作了

关于java - 如何修复(错误 : cannot find symbol class ActionOnlyNavDirections) with navigation architecture in Android studio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56226766/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com