I’m sure when you look at the Graphical Layout of any xml file in Android, what catches your attention more than the layout itself is the long list of elements on the left, called Palette. Well, here’s a list of a few frequently used Layout elements and their functions.
- TextView Large/Medium/Small : This element is used to display a static text in the layout. It is available in three sizes Large, Medium and Small.
- Button/Small Button : Well, it’s a button. Just like buttons on webpages are required to achieve a certain tasks, so it is used here. Although in reality a button is touched in an Android device to trigger it’s function, we’ll be referring it as a click hereafter.
- CheckBox : If you want your users to have options from which they can select more than one, you are going to need checkboxes.
- RadioButton : If you want your users to have options from which they can select only one, you are going to need radio buttons.
- ProgressBar Large/Small/Horizontal : It is a progress bar that you might require if your application is in the middle of something and a screen staring at the user in the meantime, is just not your style.
- All this field contains, is lots and lots of EditText. An EditText is used to create a text field where the user can provide a written input.
- There are various types of EditTexts. They differ in their “Input Type” i.e. the type of value that can be entered in them.
This field contains various types of layouts. A layout can be nested within another to achieve desired UI.
- LinearLayout Vertical/Horizontal : This allows elements within it to be added linearly.
- RelativeLayout : This allows elements within it to be added relatively to other elements.
- GridLayout : It is used to achieve a grid like UI.
- ListView : This is a rather widely used element. It helps display a number of items in a list in the layout.
- GridView : This presents a grid like view of elements. This is not at all related to GridLayout.
- ScrollView/Horizontal Scroll View : Sometimes it is required to limit the size of a layout to a certain value. However it’s content might be more than what can be accommodated in it. ScrollView is used here so that the content can be scrolled.
- SearchView : This allows searching. You must have seen a Google SearcView in an Android device.
- SlidingDrawer : This is a neat and a handy element in many situations. It is a drawer that can be opened and closed with clicks. This can be put over the layout of an activity.
IMAGES AND MEDIA
- ImageView : It is a view in which you can put in an image.
- ImageButton : It is an image and also a button. A rather fancy way to have a button, eh?
- Gallery : It is a view that can have more than one picture and hence is a gallery.
TIME AND DATE
- TimePicker : Sometimes when in your application you need the user to enter a time, a TimePicker can do that neatly. Good old EditText can serve the purpose too, but TimePicker is much more fancy and easy to work with.
- DatePicker : Just like TimePicker, DatePicker is used to pick a date.
- It deals with animations that can be used while transitions between layouts occur.
- NumberPicker : Just like TimePicker and DatePicker, this is used to pick numbers.
- ZoomButton/ZoomControls : Used to control zoom in/zoom out operations mainly in galleries.
These elements are used most frequently. There are a bunch of other elements that are present. Keep adding them to your layout and experimenting!!