The xml would be like this:
Code:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/currImage" android:id="@+id/GameLayout" />
ProjectName/res/drawable/anyImage.png
You would then change the image of the layout in the java file by getting the resource handle.
Code:
public class mainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Resources res = getResources(); //resource handle Drawable drawable = res.getDrawable(R.drawable.newImage); //new Image that was added to the res folder LinearLayout linearLayout = (LinearLayout)findViewById(R.id.GameLayout); linearLayout.setBackgroundDrawable(drawable); } }