android在xml属性中@null的含义 [英] android meaning of @null in xml attribute

查看:308
本文介绍了android在xml属性中@null的含义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个xml布局中发现了以下属性:

I found the following attribute in one xml layout:

android:background="@null"

@null是什么意思?指定background ="@ null"和省略background属性有什么区别?

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

推荐答案

如果我没记错的话,省略background属性会设置默认背景.但是,将background显式设置为"@null"会删除背景,从而导致显示元素下方的任何内容.特别是,例如,如果将Button的背景设置为null,则按钮的边框也将消失(并且按钮实际上根本不会看起来像按钮).

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

这篇关于android在xml属性中@null的含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆