{"id":1776,"date":"2013-01-17T18:16:49","date_gmt":"2013-01-17T16:16:49","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=1776"},"modified":"2013-01-30T19:08:07","modified_gmt":"2013-01-30T17:08:07","slug":"android-relativelayout-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/","title":{"rendered":"Android RelativeLayout Example"},"content":{"rendered":"<p>In Android there are may ways you can arrange the components of your Application on the screen. One of the most common layouts is the <code>RelativeLayout<\/code>. In this tutorial we are going to see how\u00a0<code>RelativeLayout<\/code>\u00a0works with some input components.<\/p>\n<p>There is a good reason why it&#8217;s called <code>RelativeLayout<\/code>. That&#8217;s because it let&#8217;s you arrange the components on your screen in\u00a0positions\u00a0relative to each other. For example, you have <code>button1 <\/code>on your screen and you want to put <code>button2 <\/code>, on top or right or left of <code>button1<\/code>. <code>RelativeLayout <\/code>uses\u00a0<code>android:layout_below<\/code>, <code>android:layout_toRightOf<\/code> etc&#8230; to let you do that. It&#8217;s one of the most flexible layouts out there.<br \/>\n&nbsp;<br \/>\nFor this tutorial, we will use the following tools in a Windows 64-bit platform:<\/p>\n<ol>\n<li>JDK 1.7<\/li>\n<li>Eclipse 4.2 Juno<\/li>\n<li>Android SKD 4.2<\/li>\n<\/ol>\n<h3>1. Create a new Android Project<\/h3>\n<p>Open Eclipse IDE and go to File -&gt; New -&gt; Project -&gt; Android -&gt; Android Application Project and click Next.<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/create-new-project6.jpg\"><img decoding=\"async\" title=\"create-new-project\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/create-new-project6.jpg\" alt=\"\" width=\"467\" height=\"460\" \/><\/a><\/p>\n<p>You have to specify the Application Name, the Project Name and the Package name in the appropriate text fields and then click Next.<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/create-new-project-attributes4.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1777\" title=\"create-new-project-attributes\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/create-new-project-attributes4.jpg\" alt=\"\" width=\"542\" height=\"440\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/create-new-project-attributes4.jpg 542w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/create-new-project-attributes4-300x243.jpg 300w\" sizes=\"(max-width: 542px) 100vw, 542px\" \/><\/a><\/p>\n<p>In the next window make sure the \u201cCreate activity\u201d option is selected in order to create a new activity for your project, and click Next. This is optional as you can create a new activity after creating the project, but you can do it all in one step.<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/check-create-new-activity10.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1778\" title=\"check-create-new-activity\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/check-create-new-activity10.jpg\" alt=\"\" width=\"524\" height=\"478\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/check-create-new-activity10.jpg 524w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/check-create-new-activity10-300x273.jpg 300w\" sizes=\"(max-width: 524px) 100vw, 524px\" \/><\/a><div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>Select \u201cBlankActivity\u201d and click Next.<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/create-blanc-activity.jpg\"><img decoding=\"async\" title=\"create-blanc-activity\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/create-blanc-activity.jpg\" alt=\"\" width=\"535\" height=\"485\" \/><\/a><\/p>\n<p>You will be asked to specify some information about the new activity. \u00a0In the Layout Name text field you have to specify the name of the file that will contain the layout description of your app. In our case the file\u00a0<code>res\/layout\/main.xml<\/code>\u00a0will be created. Then, click Finish.<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/create-new-activity-attributes3.jpg\"><img decoding=\"async\" title=\"create-new-activity-attributes\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/create-new-activity-attributes3.jpg\" alt=\"\" width=\"625\" height=\"452\" \/><\/a><\/p>\n<h3>2. RelativeLayout example<\/h3>\n<p>Open\u00a0<code>res\/layout\/main.xml<\/code>\u00a0file :<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/package-explorer-layout7.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1779\" title=\"package-explorer-layout\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/package-explorer-layout7.jpg\" alt=\"\" width=\"359\" height=\"458\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/package-explorer-layout7.jpg 359w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/package-explorer-layout7-235x300.jpg 235w\" sizes=\"(max-width: 359px) 100vw, 359px\" \/><\/a><\/p>\n<p>And paste the following code :<\/p>\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;RelativeLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n    android:layout_width=\"fill_parent\"\r\n    android:layout_height=\"fill_parent\" &gt;\r\n\r\n    &lt;Button\r\n        android:id=\"@+id\/button1\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:text=\"Button 1\"\/&gt;\r\n\r\n     &lt;TextView\r\n         android:id=\"@+id\/textView\"\r\n         android:layout_width=\"wrap_content\"\r\n         android:layout_height=\"wrap_content\"\r\n         android:layout_below=\"@+id\/button3\"\r\n         android:layout_marginTop=\"65dp\"\r\n         android:text=\"Username :\"\r\n         android:textAppearance=\"?android:attr\/textAppearanceLarge\" \/&gt;\r\n\r\n     &lt;EditText\r\n         android:id=\"@+id\/editText\"\r\n         android:layout_width=\"wrap_content\"\r\n         android:layout_height=\"wrap_content\"\r\n         android:layout_alignParentRight=\"true\"\r\n         android:layout_alignTop=\"@+id\/textView\"\r\n         android:layout_toRightOf=\"@+id\/button2\"\r\n         android:inputType=\"text\" \/&gt;\r\n\r\n     &lt;Button\r\n         android:id=\"@+id\/button0\"\r\n         android:layout_width=\"wrap_content\"\r\n         android:layout_height=\"wrap_content\"\r\n         android:layout_alignParentRight=\"true\"\r\n         android:layout_below=\"@+id\/editText\"\r\n         android:text=\"Submit\" \/&gt;\r\n\r\n     &lt;Button\r\n         android:id=\"@+id\/button3\"\r\n         android:layout_width=\"wrap_content\"\r\n         android:layout_height=\"wrap_content\"\r\n         android:layout_alignParentLeft=\"true\"\r\n         android:layout_below=\"@+id\/button1\"\r\n         android:text=\"Button 3\" \/&gt;\r\n\r\n     &lt;Button\r\n         android:id=\"@+id\/button2\"\r\n         android:layout_width=\"wrap_content\"\r\n         android:layout_height=\"wrap_content\"\r\n         android:layout_below=\"@+id\/button1\"\r\n         android:layout_toRightOf=\"@+id\/button1\"\r\n         android:text=\"Button 2\" \/&gt;\r\n\r\n&lt;\/RelativeLayout&gt;<\/pre>\n<p>I think that the above code is pretty self\u00a0explanatory, but there are one or two attributes that need a bit more of your attention. The android:layout_below,\u00a0\u00a0android:layout_toRightOf attributes have a very clear role, as we explained in the introduction of this tutorial. Now let&#8217;s take a look at the &#8220;Submit&#8221; button and the<code> android:layout_alignParentRight<\/code> attribute. The parent of this element is the element that we used to relatively position the button. In this case the <code>@+id\/editText<\/code> item. The <code> android:layout_alignParentRight<\/code> dictates that the button will be right-alligned on the bottom of the <code>editText\u00a0<\/code>component, as you can see below on the Graphical Layout editor:<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/graphical-layout-editor7.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1785\" title=\"graphical-layout-editor\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/graphical-layout-editor7.jpg\" alt=\"\" width=\"506\" height=\"656\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/graphical-layout-editor7.jpg 506w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/graphical-layout-editor7-231x300.jpg 231w\" sizes=\"(max-width: 506px) 100vw, 506px\" \/><\/a><\/p>\n<p>Now you can drag these items around the screen using your mouse and then turn back to the xml mode to see the new values of the attributes. This will help you to\u00a0understand\u00a0<code>RelativeLayout <\/code>much better.<\/p>\n<h3>3. Run the application<\/h3>\n<p>We don\u2019t really have to write any code for this tutorial, so go ahead and run the application to see how the layout looks on your emulator:<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/main-screen9.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1786\" title=\"main-screen\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/main-screen9.jpg\" alt=\"\" width=\"256\" height=\"470\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/main-screen9.jpg 256w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/main-screen9-163x300.jpg 163w\" sizes=\"(max-width: 256px) 100vw, 256px\" \/><\/a><\/p>\n<h3>Download Eclipse Project<\/h3>\n<p>This was an Android RelativeLayout Example. Download the Eclipse Project of this tutorial:\u00a0<a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/AndroidRelativeLayoutExample1.zip\">AndroidRelativeLayoutExample.zip<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Android there are may ways you can arrange the components of your Application on the screen. One of the most common layouts is the RelativeLayout. In this tutorial we are going to see how\u00a0RelativeLayout\u00a0works with some input components. There is a good reason why it&#8217;s called RelativeLayout. That&#8217;s because it let&#8217;s you arrange the &hellip;<\/p>\n","protected":false},"author":7,"featured_media":1202,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[311],"tags":[265,288,267],"class_list":["post-1776","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-relativelayout","tag-android-core","tag-android-relativelayout","tag-android-ui"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Android RelativeLayout Example<\/title>\n<meta name=\"description\" content=\"In Android there are may ways you can arrange the components of your Application on the screen. One of the most common layouts is the RelativeLayout. In\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android RelativeLayout Example\" \/>\n<meta property=\"og:description\" content=\"In Android there are may ways you can arrange the components of your Application on the screen. One of the most common layouts is the RelativeLayout. In\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2013-01-17T16:16:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-01-30T17:08:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Ilias Tsagklis\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ilias Tsagklis\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/\"},\"author\":{\"name\":\"Ilias Tsagklis\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/ca18b1aa108e3bfadf717e563e0a7a6e\"},\"headline\":\"Android RelativeLayout Example\",\"datePublished\":\"2013-01-17T16:16:49+00:00\",\"dateModified\":\"2013-01-30T17:08:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/\"},\"wordCount\":477,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"keywords\":[\"Android Core\",\"Android RelativeLayout\",\"Android UI\"],\"articleSection\":[\"RelativeLayout\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/\",\"name\":\"Android RelativeLayout Example\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"datePublished\":\"2013-01-17T16:16:49+00:00\",\"dateModified\":\"2013-01-30T17:08:07+00:00\",\"description\":\"In Android there are may ways you can arrange the components of your Application on the screen. One of the most common layouts is the RelativeLayout. In\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"core\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"ui\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/ui\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"RelativeLayout\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/ui\/relativelayout\/\"},{\"@type\":\"ListItem\",\"position\":6,\"name\":\"Android RelativeLayout Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/ca18b1aa108e3bfadf717e563e0a7a6e\",\"name\":\"Ilias Tsagklis\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/Ilias-Tsagklis_avatar_1454249217-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/Ilias-Tsagklis_avatar_1454249217-96x96.jpg\",\"caption\":\"Ilias Tsagklis\"},\"description\":\"Ilias is a software developer turned online entrepreneur. He is co-founder and Executive Editor at Java Code Geeks.\",\"sameAs\":[\"http:\/\/www.iliastsagklis.com\/\",\"https:\/\/www.linkedin.com\/in\/iliastsagklis\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/ilias-tsagklis\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android RelativeLayout Example","description":"In Android there are may ways you can arrange the components of your Application on the screen. One of the most common layouts is the RelativeLayout. In","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/","og_locale":"en_US","og_type":"article","og_title":"Android RelativeLayout Example","og_description":"In Android there are may ways you can arrange the components of your Application on the screen. One of the most common layouts is the RelativeLayout. In","og_url":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2013-01-17T16:16:49+00:00","article_modified_time":"2013-01-30T17:08:07+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","type":"image\/jpeg"}],"author":"Ilias Tsagklis","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Ilias Tsagklis","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/"},"author":{"name":"Ilias Tsagklis","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/ca18b1aa108e3bfadf717e563e0a7a6e"},"headline":"Android RelativeLayout Example","datePublished":"2013-01-17T16:16:49+00:00","dateModified":"2013-01-30T17:08:07+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/"},"wordCount":477,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","keywords":["Android Core","Android RelativeLayout","Android UI"],"articleSection":["RelativeLayout"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/","url":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/","name":"Android RelativeLayout Example","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","datePublished":"2013-01-17T16:16:49+00:00","dateModified":"2013-01-30T17:08:07+00:00","description":"In Android there are may ways you can arrange the components of your Application on the screen. One of the most common layouts is the RelativeLayout. In","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/relativelayout\/android-relativelayout-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Android","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/"},{"@type":"ListItem","position":3,"name":"core","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/"},{"@type":"ListItem","position":4,"name":"ui","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/ui\/"},{"@type":"ListItem","position":5,"name":"RelativeLayout","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/ui\/relativelayout\/"},{"@type":"ListItem","position":6,"name":"Android RelativeLayout Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/ca18b1aa108e3bfadf717e563e0a7a6e","name":"Ilias Tsagklis","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/Ilias-Tsagklis_avatar_1454249217-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/Ilias-Tsagklis_avatar_1454249217-96x96.jpg","caption":"Ilias Tsagklis"},"description":"Ilias is a software developer turned online entrepreneur. He is co-founder and Executive Editor at Java Code Geeks.","sameAs":["http:\/\/www.iliastsagklis.com\/","https:\/\/www.linkedin.com\/in\/iliastsagklis"],"url":"https:\/\/examples.javacodegeeks.com\/author\/ilias-tsagklis\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/1776","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=1776"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/1776\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1202"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=1776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=1776"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=1776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}