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?
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> .
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/> .
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With