[英]Android studio navigation editor is not showing the fragment's attributes
我在android studio中使用導航編輯器 ,而我的android studio版本是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=
。 根據《 實施導航》文檔 ,它們分別是android:id=
, android:name=
和android:label=
。
請注意,您最上面的<navigation>
元素還必須包含xmlns:android="http://schemas.android.com/apk/res/android"
才能使用android:
前綴。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.