***Last updated on 11 May 2013 ***

Friday, 8 February 2013

Layout In Android

Well Hello, Today we are going to learn about Layouts. What are layouts? But first you all know that an android app consists of several screens or windows rather. For example when you open Angry Birds what you see first is a Welcome screen loading some stuff, then you see a screen where you choose the level you want to play etc. Well designing those screens and how they should look is all about layouts. For making android apps we will be using XML for layouts. See the following screenshot. The area marked as red has two tabs.

1. Graphical Layout : It is where you see how your layout/screen will look after you are done with your app. Dragging and dropping elements can be done here.


2. home.xml : It is the xml file that will be used for designing the Home class/activity's screen. Which means when your apps runs in your phone. Whenever the the Home Activity or the Home Class(Both are the same thing)  is run you are going to see the layout designed in home.xml. Any change done while dragging and dropping in the Graphical Layout will be reflected into your xml file. Beginners please do not use Graphical Layout for designing now. We will be using XML only and there is no need to refer XML as it is not required. So if you do not know XML, don't panic.

All the layout files must be stored/saved in res/layout

res : res is the resources directory in your project. Here all the project related data such as sound, buttons, animations,background images,icons etc. are saved.

These are somethings that I have covered in this post. Rest later..You can try changing the text "hello world" for the time being and see the changes reflected on the layout. By default the layout used in our xml file is Relative Layout. I will throw more light on that in my next post. For any queries shoot me with comments.

No comments:

Post a Comment