I am need a logic to change the xml background programatically instead of giving the backgroung color from xml file. here i used setContentView(R.layout.main); to show the xml file in application. But i need to change the background color of main.xml file in java code.
Share
Following is the example that shows how can you make it. Here i have taken LinearLayout as the root node of xml file. In java code i have shown that how to set white background. I think this code will help you.
xml file
java code
It can also possible to set color using Hex code as shown below,
Even you can set drawable also,