5B4AIT Calendar
February 2012
M T W T F S S
« Jan   Mar »
 12345
6789101112
13141516171819
20212223242526
272829  
HamSphere Forums

HamSphere info

Yahoo! Weather Forecasts
Cyprus Mail News

HamSphere on Android

LayOut managers

I have now explored the Android development suite a little more. As you may know, Android is purely based on Java.

The UI design is based on a quite clever XML based concept. But the LayOut management reminds me very much of the initial Java development back in 1996 when Java first saw its light. Actually the Android people have deprecated one of the most tempting Layout Managers called “AbsoluteLayout”. The reason why this manager is deprecated is that Android phones come in so many shapes and sizes. It is virtually impossible to make a “fixed pixel” application for a mobile phone, so I really do not understand why the fixed position Layout was there in the first place. OK, so what are the alternatives then?

The standard Layouts are:

FrameLayout

FrameLayout is designed to display a single item at a time.  You can have multiple elements within a FrameLayout but each element will be positioned based on the top left of the screen.  Elements that overlap will be displayed overlapping.  I have created a simple XML layout using FrameLayout that shows how this works.

LinearLayout

LinearLayout organizes elements along a single line.  You specify whether that line is verticle or horizontal using android:orientation

RelativeLayout

RelativeLayout lays out elements based on their relationships with one another, and with the parent container.  This is arguably the most complicated layout, and we need several properties to actually get the layout we want.

TableLayout

TableLayout organizes content into rows and columns.  The rows are defined in the layout XML, and the columns are determined automatically by Android.  This is done by creating at least one column for each element.  So, for example, if you had a row with two elements and a row with five elements then you would have a layout with two rows and five columns.

What Layout to choose for HamSphere?

I have been playing with all of the above, but the Layout Manager that feels the most tempting is the TableLayout. Howevere it may cause the app to look a bit “off” in some phones. The Relative Layout could possibly work if I use the frame outer edges as reference. We’ll see.

Kelly

 

Leave a Reply

Solar-Terrestrial Data
free counters

IP address
Tag Cloud