amitgoswami
amitgoswami

Reputation: 51

Documentation Clarification for Android Layout ID parameter needed

I have a doubt in android documentation in the following link.

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

Why is nextFocusDown having a "+" id (android:nextFocusDown=”@+id/text”)?nextFocusUp="@id/edit" is without the "+" id ? shouldn't both be without "+"

<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>

I am referring to this section of the android documentation.

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).

Upvotes: 1

Views: 88

Answers (1)

Umit Kaya
Umit Kaya

Reputation: 5951

You are using the XML attribute of android:id, then you are specifying a new id to create a new entry in R.java, that is why you have to include (+) sign.

But in here:

android:nextFocusUp="@id/edit"

you are referring to an id that has already been created above.

Upvotes: 1

Related Questions