Is there any difference between @null Vs transparent(#00000000)
in my layout I set android:background"@color/transparent"
but its showing some other different background color that I used.
when I used null its working fine.
I want to set @null thru programmatic.
how to do?
@nullmeans no background at all (View.getBackground() returns null).#00000000means that you got a ColorDrawable as the background which has a fully-transparent color.I didn’t look at the code, but I guess that the framework tests if the ColorDrawable is fully transparent and does not draw it in this case. Otherwise you would have some drawing overhead, making
@nullthe faster choice. Both should look identical, so not sure if this is your underlying isse.To set the equivalent of
@nullin code, useView.setBackgroundDrawable(null).