Wednesday, January 28, 2009

Creating an XML Layout File :

Now that you have an image resource, you can add it to your XML layout file.

These files are kept in res/layout/, and you should currently have one called main.xml.

Add a new XML file called splash.xml, and copy the contents of the main.xml file into it.

Next, modify the file by removing the tag and add an tag that

looks like the following: 

android:layout_width="fill_parent" 

android:layout_height="fill_parent"> 

 

Using Android’s XML layout objects is simple and straightforward.

As I mentioned, files in the /res directories can be referenced with the @ symbol

as shown earlier, for example, android:src="@drawable/menu_background".

Further, layout_width and layout_height dictate the size of the image view.

Look to make sure your new layout file has been added to R.java.

It should appear as follows:

public static final int splash=0x7f030001; 

No comments: