Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Declaring android:id why use a "+"?

When declaring the id there is a "+" sign but when referencing it there is no sign. Why is that? What is the function of the + sign?

<TextView
android:id="@+id/label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Type here:"/>
<EditText
android:id="@+id/entry"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:layout_below="@id/label"/>
like image 853
haplessG00N Avatar asked May 04 '26 10:05

haplessG00N


1 Answers

The + creates an id that lets you reference the TextView and EditText objects in your java code. So if you wanted to access the TextView you created in your java code, you could access it via R.id.label. And the EditText can be accessed via R.id.entry

like image 112
triad Avatar answered May 05 '26 22:05

triad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!