Layout Basics
A user interface template drawn on the screen. This templates can be managed using XML files in android and stored in res/layout directory for the application. A group of controls defined and organized in the user interface
An Android layout is a class that handles the screen arrangements for this child elements. Anything that is a View (or inherits from View) can be a child of a layout.
You can nest the layout and you can create the custom layouts by inherit from ViewGroup.
following is the list of standard layouts
AbsoluteLayout
FrameLayout
LinearLayout
RelativeLayout
TableLayout
This post is explaining the AbsoluteLayout
AbsoluteLayout places each control at an absolute position. The exact x and y positions need specify for each control.
The Absolute Layout is difficult to maintain for most of the UIs as adding a new control is not flexible in the absolute layouts.
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:layout_x="10px" android:layout_y="110px" android:text="Layout" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:layout_x="150px" android:layout_y="110px" android:text="Absolute layout" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </AbsoluteLayout>
Each control specify a x and y positions by android:layout_x and android:layout_y.
Android defines the top left of the screen as (0,0) and x coordinate move from
left to right and y move from top to bottom.
See the screen shot here for above example.
Absolute layout |
ReplyDeleteYour blog is very useful for me, as your tutorial sessions are indeed of great benefit.Android training in chennai with placement | Android Training in chennai |Android Training in Velachery
Thanks for your tutorial, its working fine but i'm having a problem, i imported content for a tab, when i run it separately everything is working fine but when its under a tab, my spinners are blank and my buttons arent working as they should, toasters not apearing on screen, what can the problem be?..Android Training in chennai | Android Training|Android Training in chennai with placement | Android Training in velachery
ReplyDelete