简体   繁体   English

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

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

I am using Navigation Editor in the android studio and my android studio version is 3.3.2 . 我在android studio中使用导航编辑器 ,而我的android studio版本是3.3.2

my problem is when I add a fragment to the navigation editor, the attributes of the fragment are not showing in design mode. 我的问题是,当我向导航编辑器中添加片段时,片段的属性未在设计模式下显示。 look at the picture: 看图片:

在此处输入图片说明

mobile_navigation.xml 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>

as you see my fragments in XML have name and label and id attributes but all of them are labeled as fragment . 如您所见,我的XML片段具有名称,标签和ID属性,但所有标签都标记为fragment even when I set the attributes from the design mode after pressing Enter the text is gone but it changes in XML text. 即使在按Enter键后从设计模式设置属性,文本也消失了,但是XML文本却改变了。

I have tried Invalidate Caches/Restart but the problem still exists. 我已经尝试过使Invalidate Caches/Restart但是问题仍然存在。

Any help? 有什么帮助吗?

You're using id= , name= , and label= . 您正在使用id=name=label= As per the Implementing Navigation documentation , these need to be android:id= , android:name= , and android:label= , respectively. 根据《 实施导航》文档 ,它们分别是android:id=android:name=android:label=

Note that your topmost <navigation> element must also contain xmlns:android="http://schemas.android.com/apk/res/android" in order to use the android: prefix. 请注意,您最上面的<navigation>元素还必须包含xmlns:android="http://schemas.android.com/apk/res/android"才能使用android:前缀。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM