{"id":1760,"date":"2013-01-16T14:07:22","date_gmt":"2013-01-16T12:07:22","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=1760"},"modified":"2013-01-30T19:09:10","modified_gmt":"2013-01-30T17:09:10","slug":"android-linearlayout-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/","title":{"rendered":"Android LinearLayout 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>LinearLayout<\/code>. In this tutorial we are going to see how <code>LinearLayout<\/code> works with two different orientation options, for three buttons. An important feature that we are going to discuss is the <code>android:layout_weight<\/code> attribute of the buttons. This attribute determines the proportion of the screen that each button is going to cover.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n<p>For 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-attributes3.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1761\" title=\"create-new-project-attributes\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/create-new-project-attributes3.jpg\" alt=\"\" width=\"522\" height=\"438\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/create-new-project-attributes3.jpg 522w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/create-new-project-attributes3-300x251.jpg 300w\" sizes=\"(max-width: 522px) 100vw, 522px\" \/><\/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-activity9.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1762\" title=\"check-create-new activity\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/check-create-new-activity9.jpg\" alt=\"\" width=\"528\" height=\"471\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/check-create-new-activity9.jpg 528w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/check-create-new-activity9-300x267.jpg 300w\" sizes=\"(max-width: 528px) 100vw, 528px\" \/><\/a><\/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.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/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. Horizontal LinearLayout 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-layout6.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1763\" title=\"package-explorer-layout\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/package-explorer-layout6.jpg\" alt=\"\" width=\"352\" height=\"447\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/package-explorer-layout6.jpg 352w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/package-explorer-layout6-236x300.jpg 236w\" sizes=\"(max-width: 352px) 100vw, 352px\" \/><\/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;LinearLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n    android:layout_width=\"fill_parent\"\r\n    android:layout_height=\"fill_parent\"\r\n    android:orientation=\"horizontal\" &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;Button\r\n        android:id=\"@+id\/button2\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:text=\"Button 2\" \/&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:text=\"Button 3\" \r\n        android:layout_weight=\"1\"\/&gt;\r\n\r\n&lt;\/LinearLayout&gt;<\/pre>\n<p>Notice the <code>android:orientation=\"horizontal\"<\/code> attribute of the <code>LinearLayout<\/code>\u00a0tag. This will put the buttons in an horizontal order. The other thing that is important about the above code is the <code>android:layout_weight=\"1\"<\/code> attribute of the third button. Notice that the other two button did not specify this attributes, so by default they have the same value (which is zero&#8230;) and as a result they cover the same proportion of the sceen (they have the same size&#8230;). But the third button will cover up the remaining space of the screen because it has the biggest weight value. Now you may open the Graphical layout editor to preview the User Interface you created. The warning signs are just because we haven&#8217;t created and used string resources for the Button Labels, but that&#8217;s not really important in this tutorial:<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/graphical-layout-editor5.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1764\" title=\"graphical-layout-editor\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/graphical-layout-editor5.jpg\" alt=\"\" width=\"533\" height=\"651\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/graphical-layout-editor5.jpg 533w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/graphical-layout-editor5-245x300.jpg 245w\" sizes=\"(max-width: 533px) 100vw, 533px\" \/><\/a><\/p>\n<h3>3. Run the application<\/h3>\n<p>We don&#8217;t 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-screen-horizontal.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1765\" title=\"main-screen-horizontal\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/main-screen-horizontal.jpg\" alt=\"\" width=\"256\" height=\"470\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/main-screen-horizontal.jpg 256w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/main-screen-horizontal-163x300.jpg 163w\" sizes=\"(max-width: 256px) 100vw, 256px\" \/><\/a><\/p>\n<h3>4. Vertical LinearLayout example<\/h3>\n<p>Go back to\u00a0<code>res\/layout\/main.xml<\/code>\u00a0file and paste the following code:<\/p>\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;LinearLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n    android:layout_width=\"fill_parent\"\r\n    android:layout_height=\"fill_parent\"\r\n    android:orientation=\"vertical\" &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;Button\r\n        android:id=\"@+id\/button2\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:text=\"Button 2\" \/&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:text=\"Button 3\" \r\n        android:layout_weight=\"1\"\/&gt;\r\n\r\n&lt;\/LinearLayout&gt;<\/pre>\n<p>As you can see, we&#8217;ve changed the orientation to vertical, but the biggest weight value is still on the third button. So this is how it looks like in the Graphical Layout editor:<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/graphical-layout-editor-vertical.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1767\" title=\"graphical-layout-editor-vertical\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/graphical-layout-editor-vertical.jpg\" alt=\"\" width=\"542\" height=\"681\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/graphical-layout-editor-vertical.jpg 542w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/graphical-layout-editor-vertical-238x300.jpg 238w\" sizes=\"(max-width: 542px) 100vw, 542px\" \/><\/a><\/p>\n<h3>5. Run the application<\/h3>\n<p>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-screen-vertical1.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1768\" title=\"main-screen-vertical\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/main-screen-vertical1.jpg\" alt=\"\" width=\"256\" height=\"470\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/main-screen-vertical1.jpg 256w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/main-screen-vertical1-163x300.jpg 163w\" sizes=\"(max-width: 256px) 100vw, 256px\" \/><\/a><\/p>\n<p>And that&#8217;s it. You can experiment with different values of the <code>android:layout_weight<\/code> attributes on all of the buttons and see the results for better understanding of the use of this attribute. As you will notice the size of the buttons will be proportionate with the value of the\u00a0\u00a0<code>android:layout_weight<\/code>\u00a0attributes of each button.<\/p>\n<h3>Download Eclipse Project<\/h3>\n<p>This was an Android LinearLayout Example. Download the Eclipse Project of this tutorial:\u00a0<a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/01\/AndroidLinearLayoutExample.zip\">AndroidLinearLayoutExample.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 LinearLayout. In this tutorial we are going to see how LinearLayout works with two different orientation options, for three buttons. An important feature that we are going to discuss is &hellip;<\/p>\n","protected":false},"author":7,"featured_media":1202,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[312],"tags":[265,287,267],"class_list":["post-1760","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linearlayout","tag-android-core","tag-android-linearlayout","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 LinearLayout 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 LinearLayout. 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\/linearlayout\/android-linearlayout-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android LinearLayout 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 LinearLayout. In\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-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-16T12:07:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-01-30T17:09:10+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\/linearlayout\/android-linearlayout-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/\"},\"author\":{\"name\":\"Ilias Tsagklis\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/ca18b1aa108e3bfadf717e563e0a7a6e\"},\"headline\":\"Android LinearLayout Example\",\"datePublished\":\"2013-01-16T12:07:22+00:00\",\"dateModified\":\"2013-01-30T17:09:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/\"},\"wordCount\":560,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"keywords\":[\"Android Core\",\"Android LinearLayout\",\"Android UI\"],\"articleSection\":[\"LinearLayout\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/\",\"name\":\"Android LinearLayout Example\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"datePublished\":\"2013-01-16T12:07:22+00:00\",\"dateModified\":\"2013-01-30T17:09:10+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 LinearLayout. In\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-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\/linearlayout\/android-linearlayout-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\":\"LinearLayout\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/ui\/linearlayout\/\"},{\"@type\":\"ListItem\",\"position\":6,\"name\":\"Android LinearLayout 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 LinearLayout 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 LinearLayout. 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\/linearlayout\/android-linearlayout-example\/","og_locale":"en_US","og_type":"article","og_title":"Android LinearLayout 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 LinearLayout. In","og_url":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2013-01-16T12:07:22+00:00","article_modified_time":"2013-01-30T17:09:10+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\/linearlayout\/android-linearlayout-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/"},"author":{"name":"Ilias Tsagklis","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/ca18b1aa108e3bfadf717e563e0a7a6e"},"headline":"Android LinearLayout Example","datePublished":"2013-01-16T12:07:22+00:00","dateModified":"2013-01-30T17:09:10+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/"},"wordCount":560,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","keywords":["Android Core","Android LinearLayout","Android UI"],"articleSection":["LinearLayout"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/","url":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/","name":"Android LinearLayout Example","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","datePublished":"2013-01-16T12:07:22+00:00","dateModified":"2013-01-30T17:09:10+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 LinearLayout. In","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/linearlayout\/android-linearlayout-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\/linearlayout\/android-linearlayout-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":"LinearLayout","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/ui\/linearlayout\/"},{"@type":"ListItem","position":6,"name":"Android LinearLayout 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\/1760","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=1760"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/1760\/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=1760"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=1760"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=1760"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}