If I set a @null
for example to app:tabTextColor
in layout xml app:tabTextColor="@null"
, what is @null
compiled to?

- 2,606
- 6
- 24
- 40
-
What do you mean when you are saying 'compiled to'? Are you asking what the meaning of it is or what? – HB. Nov 28 '17 at 19:08
-
1check this one. https://stackoverflow.com/q/9311123/2956135 – Emma Nov 28 '17 at 19:26
-
2Possible duplicate of [is there any diff @null Vs #00000000](https://stackoverflow.com/questions/9311123/is-there-any-diff-null-vs-00000000) – Akos Nagy Nov 28 '17 at 19:56
2 Answers
Not completely sure if this is what you are looking for but..
@null
means that the tabTextColor returns null it is equivalent in java to: tabLayout.setTabTextColors(null)
Meaning that there is no color set to the tab text. @null
basically means "nothing is set".

- 4,116
- 4
- 29
- 53
In this context app:tabTextColor="@null"
.
Whatever property we define or give is passed to the java class which uses to draw views accordingly. More info here
So if we give a button background android:background="@null"
we are giving null to our java Button class file which will draw nothing on button background. So it works just like java null passing to some method or property and will compile to null reference same as java.
And a null is represented by a 0 in bytecode after compilation
Learn more about how byte works
Read more here for null in byte code
More here for dalvik bytecode

- 10,447
- 2
- 46
- 52