gpt4 book ai didi

java - 为 Android 创建 GUI 的具体过程是什么?

转载 作者:行者123 更新时间:2023-11-29 03:33:01 25 4
gpt4 key购买 nike

<分区>

我是 Android 开发的新手。

我正在尝试使用 Eclipse 为 Android 应用设置 GUI。

当我向 GUI 添加组件(例如按钮)时,会出现一个带有感叹号的黄色三角形以及消息:[I18N] Hardcoded string "Button", should use @string resource .

Eclipse 提示我通过在字符串资源上创建一个字符串按钮来自动修复此问题,但它仍然抛出一个错误,指出属性 android:text 已经包含一个字符串引用。

我也有错误:

Couldn't resolve resource @string/name
Couldn't resolve resource @string/gps
Couldn't resolve resource @string/photo
Couldn't resolve resource @string/back
Couldn't resolve resource @string/add

无法解析资源是什么意思? name/gps/photo/add 是我的 GUI 中的组件。

我如何:

Add Components to a GUI without erroring? I want to rename the GUI components to something relevant so I can reference them in my code. What steps are generally required?

我以前用过 Visual Studio,一般只需要拖放组件,然后在属性下重命名它们。我想为我的 Android 应用程序做同样的事情 - 请帮忙!

编辑:我认为这些值是在我的字符串 xml 文件中声明的。在这里:

<string name="app_name">UCLocationSearch</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
<string name="back_button">Back Button</string>
<string name="exit">Exit<string name="add">Add</string>
<string name="gps">GPS</string>
<string name="name">Name</string>
<string name="autocompletetextview">AutoCompleteTextView</string>
<string name="photo">Photo</string>
<string name="back">Back</string>

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com