Set Background as null

  1. android:background="@null" is absolutely safe. If you want to set the background based on your logic in code, you can definitely use this; and if you do not set the background in code, it is still the same and will never cause any problems.

  2. From a performance point of view, you should load the background via XML instead of programmatically because your layout will be loaded only once from the XML. If you set it in code based on your logic, it may be loaded more than once. However, in either case, the performance is almost the same, not a big difference. You should decide which approach to use from your logic point of view (if you will never change the background, use the XML approach). The point is, use the image of the appropriate size as the background. That will make the real difference in performance. Big images will take more time to load in either approach.


i think you are looking for this:

android:background="@android:color/transparent"

Tags:

Android