Kirk
Kirk

Reputation: 5077

What is the different between style="?android:attr/" and style="@android:attr"

I would like to know how these tags work in android xml. for instance in styling

style="?android:attr/buttonBarButtonStyle" and style="@android:attr/buttonBarButtonStyle"

I've tried to find out my self but these tags gave me almost same result in my previous project. couldn't find out the clear answer on the internet though

and sometimes the android layout xml id's are different @id/ and @+/id?, stating with + sign what is the reason behind that?

Any pioneered Android Dev's in this field?

Upvotes: 0

Views: 319

Answers (1)

Nitesh Tiwari
Nitesh Tiwari

Reputation: 4762

1.@+/id : It is used to assign the Id to the Newly Created View in the Layout

2.@id/ : It is used to get the Reference of the View

Ex: This Will Create New Id

 <Button
        android:id="@+id/ui_button_click"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
/>

Ex: This Will Reference the Id Created

<Button
        android:id="@+id/ui_second_click"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@id/ui_button_click" --->Referencing the First One
        android:text="Button" />

Upvotes: 1

Related Questions