How to fix (error: cannot find symbol class ActionOnlyNavDirections) with navigation architecture in Android studio
How to fix (error: cannot find symbol class ActionOnlyNavDirections) with navigation architecture in Android studio
我在 Android 工作室中使用导航架构组件。我将它与底部应用程序栏一起使用,它运行良好,但每当我尝试添加操作时,我都会在启动应用程序时收到此错误(错误:找不到符号 class "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 和我的应用程序中的所有依赖项并且它有效
我在 Android 工作室中使用导航架构组件。我将它与底部应用程序栏一起使用,它运行良好,但每当我尝试添加操作时,我都会在启动应用程序时收到此错误(错误:找不到符号 class "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 和我的应用程序中的所有依赖项并且它有效