无法添加 Preferences.xml(XML 中的 Android 首选项)

发布于 2024-10-01 09:23:22 字数 246 浏览 1 评论 0原文

希望这是一个可以快速回答的新手问题...

我试图在新的 Android 项目中添加一个简单的首选项文件(新建 -> Android XML 文件),但它似乎无法正常工作。

当我选择首选项类型布局时,没有可供选择的根元素。如果我按“完成”,它不会执行任何操作。请参阅下面的屏幕截图。

谢谢, wTs

替代文本

Hopefully, this is a newbie question with a quick answer...

I am attempting to add a simple preferences file in a new Android project (New -> Android XML File), but it doesn't appear to be working correctly.

There is no root element to choose from when I select the Preference type layout. If I press Finish, it doesn't do anything. See screenshot below.

Thanks,
wTs

alt text

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

日记撕了你也走了 2024-10-08 09:23:22

只需在项目 /res/xml/ 文件夹中创建一个普通的 xml 文件,然后像往常一样将内容添加到该文件中。应该工作得很好。添加首选项-xml 并保存后,Eclipse 会将其检测为首选项文件。

Just create a normal xml file to the project /res/xml/ folder and add your content to the file as usual. Should work just great. Eclipse detects it as a preference file once you have added the preference-xml and saved it.

五里雾 2024-10-08 09:23:22

您不需要在选择屏幕中具有根元素。只需将 eclipse 生成的内容替换为你想要的内容即可。

You don't need to have a root element in the selection screen. Just replace whatever eclipse generates with what you want.

不乱于心 2024-10-08 09:23:22

尝试刷新文件所在的文件夹(在您的示例 res/xml 中)。

try refreshing the folder that the file is supposed to be in (in your example res/xml).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文