SlideShare una empresa de Scribd logo
1 de 19
Disclaimer:This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
LAYOUTS IN
 ANDROID
     Ashwin Anand V
     Email:ashwinanand99@gmail.com
     Facebook id:ashwinanand99@gmail.com
Android Layout
• An Android layout is a class that handles arranging the way its
children appear on the screen. Anything that is a View can be a
child of a layout.

• The standard layouts are,
    Linear
    Absolute
    Relative
    Frame
    Table
Absolute Layout
Absolute Layout is based on the simple idea of placing each
control at an absolute position.
    Specify the exact x and y coordinates on the screen for
   each control
    It was used rarely because it makes inflexibilities so very
   risk to maintain
<AbsoluteLayout
xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <Button
       android:id="@+id/backbutton"
       android:text="Back"
       android:layout_x="10px"
       android:layout_y="5px"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" />
    <TextView
       android:layout_x="10px"
       android:layout_y="110px"
       android:text="First Name"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" />
    <EditText
       android:layout_x="150px"
       android:layout_y="100px"
       android:width="100px"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" />
    <TextView
       android:layout_x="10px"
       android:layout_y="160px"
       android:text="Last Name"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" />
       <EditText
       android:layout_x="150px"
       android:layout_y="150px"
       android:width="100px"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" />               screenshot of the layout
</AbsoluteLayout>
Frame Layout
 Frame Layout is designed to display a single item at a time
 You can have multiple elements within a Frame Layout but each
element will be positioned based on the top left of the screen.
 Frame Layout can become more useful when elements are
hidden and displayed programmatically. You can use the attribute
android:visibility in the XML to hide specific elements
<FrameLayout
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     xmlns:android="http://schemas.android.
com/apk/res/android">

    <ImageView
    android:src="@drawable/icon"
    android:scaleType="fitCenter"
    android:layout_height="fill_parent"
    android:layout_width="fill_parent"/>

     <TextView
     android:text="Learn-Android.com"
     android:textSize="24sp"
     android:textColor="#000000"
     android:layout_height="fill_parent"
     android:layout_width="fill_parent"
     android:gravity="center"/>

</FrameLayout>

                                              screenshot of the layout
Linear Layout
Linear Layout organizes elements along a single line. You
specify whether that line is vertical or horizontal using
android:orientation. Here is a sample Layout XML using Linear
Layout.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
       android:orientation="horizontal"
       android:layout_width="fill_parent"
    android:layout_height="fill_parent">
     <Button
       android:id="@+id/backbutton"
       android:text="Back"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" />
    <TextView
       android:text="First Name"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" />
    <EditText
       android:width="100px"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" />
    <TextView
       android:text="Last Name"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" />
    <EditText
       android:width="100px"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" />
</LinearLayout>


                                                             screenshot of the layout
Relative Layout
Relative Layout 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.
Relative To Container
These properties will layout elements relative to the parent
container:

•android:layout_alignParentBottom – Places the bottom of the element on the bottom
of the container
•android:layout_alignParentLeft – Places the left of the element on the left side of the
container
•android:layout_alignParentRight – Places the right of the element on the right side of
the container
•android:layout_alignParentTop – Places the element at the top of the container
•android:layout_centerHorizontal – Centers the element horizontally within its parent
container
•android:layout_centerInParent – Centers the element both horizontally and vertically
within its container
•android:layout_centerVertical – Centers the element vertically within its parent
container
Relative To Other Elements
• android:layout_above – Places the element above the specified element
• android:layout_below – Places the element below the specified element
• android:layout_toLeftOf – Places the element to the left of the specified element
• android:layout_toRightOf – Places the element to the right of the specified element

            Alignment With Other Elements
• android:layout_alignBaseline – Aligns baseline of the new element with the baseline
of the specified element
• android:layout_alignBottom – Aligns the bottom of new element in with the bottom
of the specified element
• android:layout_alignLeft – Aligns left edge of the new element with the left edge of
the specified element
• android:layout_alignRight – Aligns right edge of the new element with the right edge
of the specified element
• android:layout_alignTop – Places top of the new element in alignment with the top
of the specified element
<RelativeLayout
       android:layout_width="fill_parent"
       android:layout_height="fill_parent"
       xmlns:android="http://schemas.android.com/apk/res/android">
       <Button
              android:id="@+id/backbutton"
              android:text="Back"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" />
       <TextView
              android:id="@+id/firstName"
              android:text="First Name"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_below="@id/backbutton" />
       <EditText
              android:id="@+id/editFirstName"
              android:width="100px"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_toRightOf="@id/firstName"
              android:layout_below="@id/backbutton"/>
       <EditText
              android:id="@+id/editLastName"
              android:width="100px"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_below="@id/editFirstName"
              android:layout_alignLeft="@id/editFirstName"/>
       <TextView
              android:id="@+id/lastName"
              android:text="Last Name"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_toLeftOf="@id/editLastName"
              android:layout_below="@id/editFirstName" />
</RelativeLayout>
Table Layout
Table Layout 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.
You can specify that an element should occupy more than one
column using android:layout_span. This can increase the total
column count as well, so if we have a row with two elements
and each element has android:layout_span=”3″ then you will
have at least six columns in your table.
<TableLayout
       android:layout_width="fill_parent"
       android:layout_height="fill_parent"
       xmlns:android="http://schemas.android.com/apk/res/an
droid">
       <TableRow>
              <Button
              android:id="@+id/backbutton"
              android:text="Back"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" />
       </TableRow>
       <TableRow>
              <TextView
              android:text="First Name"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_column="1" />
              <EditText
              android:width="100px"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" />
       </TableRow>
       <TableRow>
              <TextView
              android:text="Last Name"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_column="1" />
              <EditText
              android:width="100px"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" />
       </TableRow>
</TableLayout>
• If this presentation helped you, please visit
  our page facebook.com/baabtra and like it.
  Thanks in advance.

• www.baabtra.com | www.massbaab.com |ww
  w.baabte.com
Thank you
Contact Us

Más contenido relacionado

La actualidad más candente

Android Layout 3分クッキング
Android Layout 3分クッキングAndroid Layout 3分クッキング
Android Layout 3分クッキングYuki Anzai
 
アプリのUIを改善するための7ステップ ∼Bump Recorder の UI を設計してみたよ編∼
アプリのUIを改善するための7ステップ ∼Bump Recorder の UI を設計してみたよ編∼ アプリのUIを改善するための7ステップ ∼Bump Recorder の UI を設計してみたよ編∼
アプリのUIを改善するための7ステップ ∼Bump Recorder の UI を設計してみたよ編∼ Yuki Anzai
 
[2019] 스몰 스텝: Android 렛츠기릿!
[2019] 스몰 스텝: Android 렛츠기릿![2019] 스몰 스텝: Android 렛츠기릿!
[2019] 스몰 스텝: Android 렛츠기릿!NHN FORWARD
 
[2019] 벅스 5.0 (feat. Kotlin, Jetpack)
[2019] 벅스 5.0 (feat. Kotlin, Jetpack)[2019] 벅스 5.0 (feat. Kotlin, Jetpack)
[2019] 벅스 5.0 (feat. Kotlin, Jetpack)NHN FORWARD
 
Invading the home screen
Invading the home screenInvading the home screen
Invading the home screenMatteo Bonifazi
 
The EffiChange XPager Suite: Understanding XPages Scaffolding
The EffiChange XPager Suite: Understanding XPages ScaffoldingThe EffiChange XPager Suite: Understanding XPages Scaffolding
The EffiChange XPager Suite: Understanding XPages ScaffoldingEffiChange LLC
 
Building iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360FlexBuilding iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360Flexdanielwanja
 
Gadgets Intro (Plus Mapplets)
Gadgets Intro (Plus Mapplets)Gadgets Intro (Plus Mapplets)
Gadgets Intro (Plus Mapplets)Pamela Fox
 
Script membuat animasi di blog yeny
Script membuat animasi di blog yenyScript membuat animasi di blog yeny
Script membuat animasi di blog yenyUceng Pabyongan
 

La actualidad más candente (10)

Android Layout 3分クッキング
Android Layout 3分クッキングAndroid Layout 3分クッキング
Android Layout 3分クッキング
 
アプリのUIを改善するための7ステップ ∼Bump Recorder の UI を設計してみたよ編∼
アプリのUIを改善するための7ステップ ∼Bump Recorder の UI を設計してみたよ編∼ アプリのUIを改善するための7ステップ ∼Bump Recorder の UI を設計してみたよ編∼
アプリのUIを改善するための7ステップ ∼Bump Recorder の UI を設計してみたよ編∼
 
[2019] 스몰 스텝: Android 렛츠기릿!
[2019] 스몰 스텝: Android 렛츠기릿![2019] 스몰 스텝: Android 렛츠기릿!
[2019] 스몰 스텝: Android 렛츠기릿!
 
[2019] 벅스 5.0 (feat. Kotlin, Jetpack)
[2019] 벅스 5.0 (feat. Kotlin, Jetpack)[2019] 벅스 5.0 (feat. Kotlin, Jetpack)
[2019] 벅스 5.0 (feat. Kotlin, Jetpack)
 
Invading the home screen
Invading the home screenInvading the home screen
Invading the home screen
 
The EffiChange XPager Suite: Understanding XPages Scaffolding
The EffiChange XPager Suite: Understanding XPages ScaffoldingThe EffiChange XPager Suite: Understanding XPages Scaffolding
The EffiChange XPager Suite: Understanding XPages Scaffolding
 
Building iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360FlexBuilding iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360Flex
 
Gadgets Intro (Plus Mapplets)
Gadgets Intro (Plus Mapplets)Gadgets Intro (Plus Mapplets)
Gadgets Intro (Plus Mapplets)
 
Script membuat animasi di blog yeny
Script membuat animasi di blog yenyScript membuat animasi di blog yeny
Script membuat animasi di blog yeny
 
iWebkit
iWebkitiWebkit
iWebkit
 

Destacado (8)

Nexus
NexusNexus
Nexus
 
DALmodule and sp transaction
DALmodule and sp transactionDALmodule and sp transaction
DALmodule and sp transaction
 
Complex number
Complex numberComplex number
Complex number
 
garbage collector
garbage collectorgarbage collector
garbage collector
 
Social and phycological effect of social media
Social and phycological effect of social mediaSocial and phycological effect of social media
Social and phycological effect of social media
 
what is method overloading?
what is method overloading?what is method overloading?
what is method overloading?
 
Truthtable
TruthtableTruthtable
Truthtable
 
Web os
Web osWeb os
Web os
 

Similar a Layouts in android

Advance Android application development workshop day 2
Advance Android application development workshop day 2Advance Android application development workshop day 2
Advance Android application development workshop day 2cresco
 
android layouts
android layoutsandroid layouts
android layoutsDeepa Rani
 
06. Android Basic Widget and Container
06. Android Basic Widget and Container06. Android Basic Widget and Container
06. Android Basic Widget and ContainerOum Saokosal
 
Support Design Library
Support Design LibrarySupport Design Library
Support Design LibraryTaeho Kim
 
How to use data binding in android
How to use data binding in androidHow to use data binding in android
How to use data binding in androidInnovationM
 
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?Brenda Cook
 
Data binding 入門淺談
Data binding 入門淺談Data binding 入門淺談
Data binding 入門淺談awonwon
 
Infinum Android Talks #16 - How to shoot your self in the foot by Dino Kovac
Infinum Android Talks #16 - How to shoot your self in the foot by Dino KovacInfinum Android Talks #16 - How to shoot your self in the foot by Dino Kovac
Infinum Android Talks #16 - How to shoot your self in the foot by Dino KovacInfinum
 
Unit 2 LayoutTutorial.pptx
Unit 2 LayoutTutorial.pptxUnit 2 LayoutTutorial.pptx
Unit 2 LayoutTutorial.pptxABHIKKUMARDE
 
Android Meetup Lightning Talk
Android Meetup Lightning TalkAndroid Meetup Lightning Talk
Android Meetup Lightning TalkIrene Duke
 
Android Tutorials - Powering with Selection Widget
Android Tutorials - Powering with Selection WidgetAndroid Tutorials - Powering with Selection Widget
Android Tutorials - Powering with Selection WidgetPrajyot Mainkar
 
01 09 - graphical user interface - basic widgets
01  09 - graphical user interface - basic widgets01  09 - graphical user interface - basic widgets
01 09 - graphical user interface - basic widgetsSiva Kumar reddy Vasipally
 
Android Development Made Easy - With Sample Project
Android Development Made Easy - With Sample ProjectAndroid Development Made Easy - With Sample Project
Android Development Made Easy - With Sample ProjectJoemarie Amparo
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android AppsGil Irizarry
 
Android ui layout
Android ui layoutAndroid ui layout
Android ui layoutKrazy Koder
 

Similar a Layouts in android (20)

Chapter 5 - Layouts
Chapter 5 - LayoutsChapter 5 - Layouts
Chapter 5 - Layouts
 
Advance Android application development workshop day 2
Advance Android application development workshop day 2Advance Android application development workshop day 2
Advance Android application development workshop day 2
 
Layout
LayoutLayout
Layout
 
android layouts
android layoutsandroid layouts
android layouts
 
Android Layout.pptx
Android Layout.pptxAndroid Layout.pptx
Android Layout.pptx
 
06. Android Basic Widget and Container
06. Android Basic Widget and Container06. Android Basic Widget and Container
06. Android Basic Widget and Container
 
Support Design Library
Support Design LibrarySupport Design Library
Support Design Library
 
How to use data binding in android
How to use data binding in androidHow to use data binding in android
How to use data binding in android
 
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?
 
Data binding 入門淺談
Data binding 入門淺談Data binding 入門淺談
Data binding 入門淺談
 
Infinum Android Talks #16 - How to shoot your self in the foot by Dino Kovac
Infinum Android Talks #16 - How to shoot your self in the foot by Dino KovacInfinum Android Talks #16 - How to shoot your self in the foot by Dino Kovac
Infinum Android Talks #16 - How to shoot your self in the foot by Dino Kovac
 
Unit 2 LayoutTutorial.pptx
Unit 2 LayoutTutorial.pptxUnit 2 LayoutTutorial.pptx
Unit 2 LayoutTutorial.pptx
 
1. shared pref
1. shared pref1. shared pref
1. shared pref
 
Android Meetup Lightning Talk
Android Meetup Lightning TalkAndroid Meetup Lightning Talk
Android Meetup Lightning Talk
 
Android Tutorials - Powering with Selection Widget
Android Tutorials - Powering with Selection WidgetAndroid Tutorials - Powering with Selection Widget
Android Tutorials - Powering with Selection Widget
 
Android UI Development
Android UI DevelopmentAndroid UI Development
Android UI Development
 
01 09 - graphical user interface - basic widgets
01  09 - graphical user interface - basic widgets01  09 - graphical user interface - basic widgets
01 09 - graphical user interface - basic widgets
 
Android Development Made Easy - With Sample Project
Android Development Made Easy - With Sample ProjectAndroid Development Made Easy - With Sample Project
Android Development Made Easy - With Sample Project
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android Apps
 
Android ui layout
Android ui layoutAndroid ui layout
Android ui layout
 

Más de baabtra.com - No. 1 supplier of quality freshers

Más de baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 

Layouts in android

  • 1.
  • 2. Disclaimer:This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 3. LAYOUTS IN ANDROID Ashwin Anand V Email:ashwinanand99@gmail.com Facebook id:ashwinanand99@gmail.com
  • 4. Android Layout • An Android layout is a class that handles arranging the way its children appear on the screen. Anything that is a View can be a child of a layout. • The standard layouts are,  Linear  Absolute  Relative  Frame  Table
  • 5. Absolute Layout Absolute Layout is based on the simple idea of placing each control at an absolute position.  Specify the exact x and y coordinates on the screen for each control  It was used rarely because it makes inflexibilities so very risk to maintain
  • 6. <AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <Button android:id="@+id/backbutton" android:text="Back" android:layout_x="10px" android:layout_y="5px" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:layout_x="10px" android:layout_y="110px" android:text="First Name" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <EditText android:layout_x="150px" android:layout_y="100px" android:width="100px" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:layout_x="10px" android:layout_y="160px" android:text="Last Name" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <EditText android:layout_x="150px" android:layout_y="150px" android:width="100px" android:layout_width="wrap_content" android:layout_height="wrap_content" /> screenshot of the layout </AbsoluteLayout>
  • 7. Frame Layout  Frame Layout is designed to display a single item at a time  You can have multiple elements within a Frame Layout but each element will be positioned based on the top left of the screen.  Frame Layout can become more useful when elements are hidden and displayed programmatically. You can use the attribute android:visibility in the XML to hide specific elements
  • 8. <FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android. com/apk/res/android"> <ImageView android:src="@drawable/icon" android:scaleType="fitCenter" android:layout_height="fill_parent" android:layout_width="fill_parent"/> <TextView android:text="Learn-Android.com" android:textSize="24sp" android:textColor="#000000" android:layout_height="fill_parent" android:layout_width="fill_parent" android:gravity="center"/> </FrameLayout> screenshot of the layout
  • 9. Linear Layout Linear Layout organizes elements along a single line. You specify whether that line is vertical or horizontal using android:orientation. Here is a sample Layout XML using Linear Layout.
  • 10. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent"> <Button android:id="@+id/backbutton" android:text="Back" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:text="First Name" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <EditText android:width="100px" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:text="Last Name" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <EditText android:width="100px" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> screenshot of the layout
  • 11. Relative Layout Relative Layout 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.
  • 12. Relative To Container These properties will layout elements relative to the parent container: •android:layout_alignParentBottom – Places the bottom of the element on the bottom of the container •android:layout_alignParentLeft – Places the left of the element on the left side of the container •android:layout_alignParentRight – Places the right of the element on the right side of the container •android:layout_alignParentTop – Places the element at the top of the container •android:layout_centerHorizontal – Centers the element horizontally within its parent container •android:layout_centerInParent – Centers the element both horizontally and vertically within its container •android:layout_centerVertical – Centers the element vertically within its parent container
  • 13. Relative To Other Elements • android:layout_above – Places the element above the specified element • android:layout_below – Places the element below the specified element • android:layout_toLeftOf – Places the element to the left of the specified element • android:layout_toRightOf – Places the element to the right of the specified element Alignment With Other Elements • android:layout_alignBaseline – Aligns baseline of the new element with the baseline of the specified element • android:layout_alignBottom – Aligns the bottom of new element in with the bottom of the specified element • android:layout_alignLeft – Aligns left edge of the new element with the left edge of the specified element • android:layout_alignRight – Aligns right edge of the new element with the right edge of the specified element • android:layout_alignTop – Places top of the new element in alignment with the top of the specified element
  • 14. <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <Button android:id="@+id/backbutton" android:text="Back" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/firstName" android:text="First Name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/backbutton" /> <EditText android:id="@+id/editFirstName" android:width="100px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/firstName" android:layout_below="@id/backbutton"/> <EditText android:id="@+id/editLastName" android:width="100px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/editFirstName" android:layout_alignLeft="@id/editFirstName"/> <TextView android:id="@+id/lastName" android:text="Last Name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toLeftOf="@id/editLastName" android:layout_below="@id/editFirstName" /> </RelativeLayout>
  • 15. Table Layout Table Layout 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. You can specify that an element should occupy more than one column using android:layout_span. This can increase the total column count as well, so if we have a row with two elements and each element has android:layout_span=”3″ then you will have at least six columns in your table.
  • 16. <TableLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/an droid"> <TableRow> <Button android:id="@+id/backbutton" android:text="Back" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </TableRow> <TableRow> <TextView android:text="First Name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="1" /> <EditText android:width="100px" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </TableRow> <TableRow> <TextView android:text="Last Name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="1" /> <EditText android:width="100px" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </TableRow> </TableLayout>
  • 17. • If this presentation helped you, please visit our page facebook.com/baabtra and like it. Thanks in advance. • www.baabtra.com | www.massbaab.com |ww w.baabte.com