having a bit of an issue with my views..

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

having a bit of an issue with my views..

Postby exopolitix » Tue Sep 01, 2009 1:08 pm


I am new to android development so sorry if this question has a really obvious answer. I am hoping to make a game for the platform but to start with I have just tried to make a basic layout of 4 buttons to move in different directions and then have a background and an image in front which will be my sprite and move across the screen depending on what button is pressed.

At the moment I have created two views. One via the main xml document and the other through the java code itself. The java code one contains the background and image to be drawn and the main.xml contains the buttons.

At the moment I have my code set up like this:

this.setContentView(R.layout.main); <<<<<<<<<< xml
this.setContentView(this.myTestView); <<<<<<<<<<<<<< java

I am aware that I am basically setting one and then setting the other over the top of it and this means that only one of these views will appear. Does anyone know of a way I can use these views in conjunction so that both the images frm the java file and the layout from the xml can both be used?

Cheers for any help.

Posts: 8
Joined: Tue Sep 01, 2009 12:56 pm


Postby nmc » Tue Sep 01, 2009 6:22 pm

Senior Developer
Senior Developer
Posts: 154
Joined: Thu Nov 27, 2008 8:30 pm
Location: Germany


Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Google [Bot] and 3 guests