Knowing about XML layouts and Units of measure
We should know about XML layouts and Units of measure which is particularly important while developing apps for multiple screen sizes. So, I am practicing some XML features . U may also find this useful.
I goto Main layout file and click activity_main.xml under layout. A graphical editor is opened. Here default layout is Linear Layout. Click activity_main.xml to go to main xml source.
There is android orientation in Linear layout and by default it is vertical which means I can add items in vertical fashion.
![]() |
| Opening Activity_main.xml |
I drag a button out in graphical editor. There is a lint error in button because the word ' button' is not saved in string resource. So I have to add 'button' word in string res. In easy way I can fix it by clicking red color button at right side as shown in figure and clicking this a new window will pop up and click fix . Save project by Crtl+s , then that error is fixed.
![]() |
| Fixing the lint error |
Here layout width and height is fill_parent which means this layout gonna fill the whole screen.
And in button by default it is wrap_content. It means this button only gonna take as much space that it requires to take up.
![]() |
| Knowing about fill_parent and wrap_content |


