工具命名空间android listitem

Rij*_*jul 5 android listview android-tools-namespace

我正在尝试使用Android Studio中的"工具"命名空间功能.ListView出于设计目的,我正在尝试使用虚拟列表项填充.这里的链接说tools:listitem="@android:layout/<filename>"应该这样做.

但出于某种原因,Android Studio一直在显示Layout android:<filename> does not exist.我正在尝试为其找到解决方案,因此我不必一次又一次地使用虚拟值来运行我的应用程序进行测试.

我可能会忽略一些非常愚蠢的东西,所以请原谅我.这是我现在拥有的:

<ListView
    android:id="@+id/controllerProfiles"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="20dp"
    tools:listitem="@android:layout/profiles_list_item"/>
Run Code Online (Sandbox Code Playgroud)

我有一个文件profiles_list_item.xmlres/layout.任何建议或替代?

Moh*_*ani 7

你应该改变以下行:

tools:listitem="@android:layout/profiles_list_item"
Run Code Online (Sandbox Code Playgroud)

对此:

tools:listitem="@layout/profiles_list_item"
Run Code Online (Sandbox Code Playgroud)

@android你说你想使用Android资源的布局,但你的布局是在你自己的项目文件中.