我正在尝试使用 Android Studio 中的“工具”命名空间功能。
我正在尝试填充 ListView
带有虚拟列表项,用于设计目的。链接here说 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"/>
我有一个文件 profiles_list_item.xml
在 res/layout.
下有什么建议或替代方案吗?
最佳答案
您应该更改以下行:
tools:listitem="@android:layout/profiles_list_item"
为此:
tools:listitem="@layout/profiles_list_item"
在 @android
中,你说你想使用来自 android 资源的布局,但你的布局在你自己的项目文件中。
关于android - 工具命名空间android listitem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30877530/