gpt4 book ai didi

android - 需要 Android 布局 ID 参数的文档说明

转载 作者:行者123 更新时间:2023-11-30 02:56:53 25 4
gpt4 key购买 nike

我对以下链接中的 android 文档有疑问。

http://developer.android.com/guide/topics/ui/accessibility/apps.html

为什么 nextFocusDown 有一个 "+"id (android:nextFocusDown=”@+id/text”)?nextFocusUp="@id/edit"没有 "+"id 吗?不应该都没有“+”

<LinearLayout android:orientation="horizontal"
... >
<EditText android:id="@+id/edit"
android:nextFocusDown=”@+id/text”
... />
<TextView android:id="@+id/text"
android:focusable=”true”
android:text="Hello, I am a focusable TextView"
android:nextFocusUp=”@id/edit”
... />
</LinearLayout>

我指的是 android 文档的这一部分。

http://developer.android.com/guide/topics/ui/declaring-layout.html#attributes

The plus-symbol (+) means that this is a new resource name that must be created and added to our resources (in the R.java file).

最佳答案

您正在使用 android:id 的 XML 属性,然后指定一个新 ID 以在 R.java 中创建一个新条目,这就是为什么您必须包含 (+) 号。

但是在这里:

android:nextFocusUp="@id/edit"

您指的是上面已经创建的 id。

关于android - 需要 Android 布局 ID 参数的文档说明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23122940/

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