我在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));
答案 0 :(得分:0)
我更新了android studio及其应用程序中的所有依赖项,并成功了