07. AndroidManifest

Like the other XML files, when you open “AndroidManifest.xml” you will be faced with multiple tabs you can choose from, move on over to the xml one itself and you should see something like this:

This is again an XML file detailing aspects of the application. This time it refers to elements that are important in the overall application itself. There are many aspects to this file that really don’t need to be explained in detail at this stage of your app creation journey and so for now you just need to understand two of them:

application
This element defines some of the overarching properties of the application itself. Things like what icon to use, what the title will be, for now I’m going to get you to add the following attribute:

android:theme = "@android:style/Theme.Light"

This simply ensures that the buttons and UI elements we add to the screen look good against a light background (which ours is). There are lots of themes you can use but this will do just fine at this stage.

activity
This element tells the application details about an activity to be used. If you wanted to have multiple activities you would need multiple “activity” elements in your manifest. At this stage I’ll get you to add the following attribute to this element:

android:screenOrientation = "landscape"

It’s probably obvious what this does but by forcing this Activity to remain in landscape orientation it means it can’t reset or look odd if the user rotates their device. You can create apps that rotate orientations (and in many cases may decide that’s the best option) but in this tutorial it’s not important and this game will look better in landscape mode anyway.

As for all the other stuff in this file, don’t worry about it for now. If we need to understand any more of it then I’ll come back and explain it.

So now you should have a layout that looks a little something like this:

Now it’s time to work out how all the other bits of this UI are going to fit on this screen?

Leave a Comment

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>