Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android meaning of @null in xml attribute

I found the following attribute in one xml layout:

android:background="@null" 

What is the meaning of @null? What is the difference between specifying background="@null" and omitting background attribute?

like image 910
Maggie Avatar asked Sep 29 '11 08:09

Maggie


People also ask

How to check null value in XML?

Ways to represent a null value In an XML document, the usual way to represent a null value is to leave the element or attribute empty. Some business messages use a special value to represent a null value: <price>-999</price> .

How to pass null in XML request?

Omit the XML tag for the attribute, or use the XSD special value of xsi:nil='1' as the attribute's value. Include the XML tag for the attribute but do not follow it with a value, for example, <weight></weight> or simply <weight/> .


1 Answers

If I remember correctly, omitting the background attribute sets a default background. However, explicitly setting background to "@null" removes the background, causing whatever is below the element to be shown. In particular, if you for instance set the background of a Button to null, the border of the button will also be gone (and the button effectively will not really look like a button at all).

like image 186
Dino Avatar answered Oct 16 '22 08:10

Dino