Sha*_*uka 4 android android-architecture-components
我使用Google导航创建了全局操作.编译代码时出现以下错误
<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"
app:startDestination="@id/homeEnumerationFragment">
<fragment
android:id="@+id/homeEnumerationFragment"
android:name="org.southasia.ghru.ui.homeenumeration.HomeEnumerationFragment"
android:label="HomeEnumerationFragment"
tools:layout="@layout/home_enumeration_fragment"></fragment>
<fragment
android:id="@+id/stationFragments"
android:name="org.southasia.ghru.ui.station.StationFragment"
android:label="StationFragment"
tools:layout="@layout/station_fragment"/>
<fragment
android:id="@+id/devicesFragment"
android:name="org.southasia.ghru.ui.devices.DevicesFragment"
android:label="DevicesFragment"
tools:layout="@layout/devices_fragment"/>
<action android:id="@+id/action_global_stationFragments3" app:destination="@+id/stationFragments"/>
Run Code Online (Sandbox Code Playgroud)
错误错误:带参数或操作的目标必须具有"name"或"id"属性.
要使用全局操作,您需要为导航图指定一个ID(目前它不是自动生成的).只需在导航元素中添加'id'属性,如下所示:
<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"
app:startDestination="@id/homeEnumerationFragment"
android:id="@+id/main">
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
669 次 |
| 最近记录: |