If I use the following line in the xml layout:
android:background=\"@null\"
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.
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.