Reputation: 1074
I am using Navigation Editor in the android studio and my android studio version is 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
<?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
. even when I set the attributes from the design mode after pressing Enter the text is gone but it changes in XML text.
I have tried Invalidate Caches/Restart
but the problem still exists.
Any help?
Upvotes: 1
Views: 1350
Reputation: 200030
You're using id=
, name=
, and label=
. As per the Implementing Navigation documentation, these need to be android:id=
, android:name=
, and android:label=
, respectively.
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.
Upvotes: 2