-2

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

YTerle
  • 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
  • 1
    check this one. https://stackoverflow.com/q/9311123/2956135 – Emma Nov 28 '17 at 19:26
  • 2
    Possible 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 Answers2

0

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

HB.
  • 4,116
  • 4
  • 29
  • 53
0

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

vikas kumar
  • 10,447
  • 2
  • 46
  • 52