Android studio 导航编辑器未显示片段的属性

Android studio navigation editor is not showing the fragment's attributes

我在 android 工作室中使用 Navigation Editor,我的 android 工作室版本是 3.3.2

我的问题是当我将片段添加到导航编辑器时,片段的属性没有在设计模式中显示。看图:

mobile_navigation.xml

<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:tools="http://schemas.android.com/tools">
    <fragment id="@+id/currentWeatherFragment2"
              name="ir.houmansanati.forecastmvvm.ui.weather.current.CurrentWeatherFragment"
              label="current_weather_fragment" tools:layout="@layout/current_weather_fragment"/>
    <fragment id="@+id/futureListWeatherFragment4"
              name="ir.houmansanati.forecastmvvm.ui.weather.future.list.FutureListWeatherFragment"
              label="future_list_weather_fragment" tools:layout="@layout/future_list_weather_fragment"/>
    <fragment id="@+id/futureDetailWeatherFragment2"
              name="ir.houmansanati.forecastmvvm.ui.weather.future.detail.FutureDetailWeatherFragment"
              label="future_detail_weather_fragment" tools:layout="@layout/future_detail_weather_fragment"/>
    <fragment id="@+id/settingsFragment2" name="ir.houmansanati.forecastmvvm.ui.setting.SettingsFragment"
              label="SettingsFragment"/>
</navigation>

如您所见,我在 XML 中的片段具有名称、标签和 ID 属性,但它们都被标记为 fragment。即使我在按 Enter 后从设计模式设置属性,文本也消失了,但它在 XML 文本中发生了变化。

我已经尝试了Invalidate Caches/Restart,但问题仍然存在。

有什么帮助吗?

您正在使用 id=name=label=。根据 Implementing Navigation documentation,这些需要分别为 android:id=android:name=android:label=

请注意,最上面的 <navigation> 元素还必须包含 xmlns:android="http://schemas.android.com/apk/res/android" 才能使用 android: 前缀。