{"id":12634,"date":"2019-11-24T20:38:20","date_gmt":"2019-11-24T20:38:20","guid":{"rendered":"https:\/\/ittutorial.org\/?p=12634"},"modified":"2019-11-28T14:55:35","modified_gmt":"2019-11-28T14:55:35","slug":"android-programming-2-linear-and-relative-layout","status":"publish","type":"post","link":"https:\/\/ittutorial.org\/android-programming-2-linear-and-relative-layout\/","title":{"rendered":"Android Programming -2 Linear and Relative Layout"},"content":{"rendered":"<p>Hi guys, in this tutorial I will talk about linear and ralative layouts.<\/p>\n<p>You can think of layouts as the borders of a house.\u00a0Just as the rooms of the house cannot be outside the borders of the house,the components that we will use within our application cannot be defined outside the layouts.<\/p>\n<pre>&lt;LinearLayout\r\n    xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n    xmlns:tools=\"http:\/\/schemas.android.com\/tools\"\r\n    android:layout_width=\"match_parent\"\r\n    android:layout_height=\"match_parent\"\r\n    android:orientation=\"horizontal\"\r\n    tools:context=\".MainActivity\"&gt;<\/pre>\n<p>Linear layout allows the components to be written one by one or side by side.\u00a0It decides according to the value we give to the oriantation property of the linear layout.<\/p>\n<p>If we want the components to be ordered one by one, this feature is vertical,if we want to order side by side, we set it horizontally.\u00a0layout_width and layout_height are common to all components.\u00a0With these properties, the height and width of the component are setting.\u00a0These properties can be wrap_content and match_parent as well as numeric values.\u00a0The values we give must be in px.\u00a0Match parent feature allows the component to cover the all screen.\u00a0With wrap_content, we ensure that the component occupies as much space as the minimum footprint.<\/p>\n<pre>android:id=\u201d@+id\/add_note_button\u201d<\/pre>\n<p>With the id values given here, we can process these components in Java code.\u00a0Therefore, when defining a component, the id value must be given.\u00a0Otherwise, we cannot do any operation on this component.<\/p>\n<pre>&lt;RelativeLayout\r\n    xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n    xmlns:tools=\"http:\/\/schemas.android.com\/tools\"\r\n    android:layout_width=\"match_parent\"\r\n    android:layout_height=\"match_parent\"\r\n    tools:context=\".MainActivity\"&gt;<\/pre>\n<p>Relative layout positions the components written in relation.\u00a0Relative layout allows you to encode difficult designs with millimeter calculations where you can perform finer operations.\u00a0Relative layout also has the height and width properties like linear layuot.\u00a0These two layouts have many more features.\u00a0I will explain them by going through examples in the following lessons.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi guys, in this tutorial I will talk about linear and ralative layouts. You can think of layouts as the borders of a house.\u00a0Just as the rooms of the house cannot be outside the borders of the house,the components that we will use within our application cannot be defined outside the layouts. &lt;LinearLayout xmlns:android=&#8221;http:\/\/schemas.android.com\/apk\/res\/android&#8221; xmlns:tools=&#8221;http:\/\/schemas.android.com\/tools&#8221; &hellip;<\/p>\n","protected":false},"author":44,"featured_media":8094,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[7017,7011,7007,7005,7015,4746,7009,7008,7010,7024,3319,7021,7026,7016,7022,7025,7018,7019,7020,7006,7014,7023,7012,7013],"class_list":["post-12634","post","type-post","status-publish","format-standard","has-post-thumbnail","","category-android","tag-android-app-development","tag-android-app-development-software","tag-android-button-color-xml","tag-android-coding","tag-android-development-basics","tag-android-programming","tag-android-programming-language","tag-android-programming-tutorial","tag-android-programming-with-java","tag-android-project","tag-android-studio","tag-android-studio-basic-example","tag-android-studio-basic-projects","tag-android-studio-first-app","tag-android-studio-lessons","tag-android-studio-projects","tag-android-studio-tutorial","tag-android-studio-tutorial-for-beginners","tag-android-studio-tutorial-point","tag-android-xml-coding","tag-create-mobile-app-without-coding","tag-java-android-developer","tag-mobil-app-maker","tag-mobile-application-make"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/04\/featured-860x280.png","jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/12634","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/users\/44"}],"replies":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/comments?post=12634"}],"version-history":[{"count":1,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/12634\/revisions"}],"predecessor-version":[{"id":12635,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/12634\/revisions\/12635"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media\/8094"}],"wp:attachment":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media?parent=12634"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/categories?post=12634"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/tags?post=12634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}