{"id":140,"date":"2026-06-03T06:17:32","date_gmt":"2026-06-03T06:17:32","guid":{"rendered":"https:\/\/gigz.pk\/javaapp\/?post_type=lesson&#038;p=140"},"modified":"2026-06-06T11:18:14","modified_gmt":"2026-06-06T11:18:14","slug":"xml-layout-basics","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/javaapp\/?lesson=xml-layout-basics","title":{"rendered":"\u00a0XML Layout Basics"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">XML Layout Basics are a fundamental part of Android app development. XML (Extensible Markup Language) is used to design the user interface (UI) of Android applications. It allows developers to define the structure, appearance, and arrangement of screen elements such as buttons, text fields, images, and layouts without writing Java code for the visual design.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Understanding XML layouts is essential because every Android application relies on XML files to create attractive, responsive, and user-friendly interfaces.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is XML in Android?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">XML stands for Extensible Markup Language.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In Android development, XML is used to describe the layout and appearance of application screens.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Instead of creating UI elements through Java code, developers define them in XML files.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;TextView\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\"\n    android:text=\"Hello Android\" \/&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This XML code creates a simple text component on the screen.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Use XML Layouts?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">XML layouts provide several advantages:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Separate design from code<\/li>\n\n\n\n<li>Improve readability<\/li>\n\n\n\n<li>Simplify UI development<\/li>\n\n\n\n<li>Support responsive designs<\/li>\n\n\n\n<li>Enable visual editing tools<\/li>\n\n\n\n<li>Improve project organization<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Android applications use XML because it makes interface development faster and more manageable.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is a Layout?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A layout is a container that holds user interface components.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Examples of UI components:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>TextView<\/li>\n\n\n\n<li>Button<\/li>\n\n\n\n<li>EditText<\/li>\n\n\n\n<li>ImageView<\/li>\n\n\n\n<li>CheckBox<\/li>\n\n\n\n<li>RecyclerView<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Layouts determine how these components are positioned on the screen.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Location of Layout Files<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Layout files are stored inside:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>app\n \u2514\u2500\u2500 res\n      \u2514\u2500\u2500 layout\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>activity_main.xml\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Each screen usually has its own XML layout file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Structure of an XML Layout File<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Every XML layout begins with a root layout element.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n\n&lt;LinearLayout\n    xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"&gt;\n\n&lt;\/LinearLayout&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The root layout acts as the main container for all UI elements.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common Layout Attributes<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Attributes define the behavior and appearance of UI components.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">layout_width<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Defines component width.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>android:layout_width=\"wrap_content\"\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Possible values:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>wrap_content<\/li>\n\n\n\n<li>match_parent<\/li>\n\n\n\n<li>fixed size<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">layout_height<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Defines component height.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>android:layout_height=\"wrap_content\"\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">id<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Assigns a unique identifier.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>android:id=\"@+id\/btnSubmit\"\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Java code uses IDs to access UI components.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Understanding Width and Height<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">wrap_content<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Sizes the component according to its content.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>android:layout_width=\"wrap_content\"\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">match_parent<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Expands the component to fill available space.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>android:layout_width=\"match_parent\"\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">These values are frequently used in Android layouts.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">TextView<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">TextView displays text on the screen.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;TextView\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\"\n    android:text=\"Welcome to Android\" \/&gt;\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Common TextView Attributes<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>android:text\nandroid:textSize\nandroid:textColor\nandroid:textStyle\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">TextView is one of the most commonly used UI elements.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Button<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A Button allows users to perform actions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;Button\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\"\n    android:text=\"Submit\" \/&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Buttons are used for user interaction.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">EditText<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">EditText allows users to enter text.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;EditText\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:hint=\"Enter Name\" \/&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Common uses include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Login forms<\/li>\n\n\n\n<li>Registration forms<\/li>\n\n\n\n<li>Search fields<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">ImageView<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">ImageView displays images.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;ImageView\n    android:layout_width=\"150dp\"\n    android:layout_height=\"150dp\"\n    android:src=\"@drawable\/logo\" \/&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Images are stored in the drawable folder.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">LinearLayout<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">LinearLayout arranges components in a single direction.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Possible orientations:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Vertical<\/li>\n\n\n\n<li>Horizontal<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Vertical Layout<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;LinearLayout\n    android:orientation=\"vertical\"&gt;\n\n&lt;\/LinearLayout&gt;\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Horizontal Layout<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;LinearLayout\n    android:orientation=\"horizontal\"&gt;\n\n&lt;\/LinearLayout&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">LinearLayout is simple and beginner-friendly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example of LinearLayout<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;LinearLayout\n    xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:orientation=\"vertical\"&gt;\n\n    &lt;TextView\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"Welcome\" \/&gt;\n\n    &lt;Button\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"Click Me\" \/&gt;\n\n&lt;\/LinearLayout&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This layout places the TextView above the Button.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">ConstraintLayout<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">ConstraintLayout is the modern and recommended Android layout.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Benefits include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Better performance<\/li>\n\n\n\n<li>Flexible positioning<\/li>\n\n\n\n<li>Reduced nested layouts<\/li>\n\n\n\n<li>Responsive design support<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;androidx.constraintlayout.widget.ConstraintLayout&gt;\n\n&lt;\/androidx.constraintlayout.widget.ConstraintLayout&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Most professional Android applications use ConstraintLayout.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Margin and Padding<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Margin<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Creates space outside a component.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>android:layout_margin=\"16dp\"\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Padding<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Creates space inside a component.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>android:padding=\"16dp\"\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Margins and padding improve UI appearance.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Colors in XML<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Colors can be applied using:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>android:textColor=\"#000000\"\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Or through color resources:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>android:textColor=\"@color\/primary\"\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Using resource files improves maintainability.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Text Size<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>android:textSize=\"20sp\"\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>sp<\/code> unit is recommended for text sizing.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using IDs in XML<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>android:id=\"@+id\/txtName\"\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Accessing in Java:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>TextView txtName =\n        findViewById(R.id.txtName);\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">IDs connect XML components with Java code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Complete XML Layout Example<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n\n&lt;LinearLayout\n    xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:orientation=\"vertical\"\n    android:padding=\"16dp\"&gt;\n\n    &lt;TextView\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"Student Registration\"\n        android:textSize=\"24sp\" \/&gt;\n\n    &lt;EditText\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:hint=\"Enter Name\" \/&gt;\n\n    &lt;Button\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"Register\" \/&gt;\n\n&lt;\/LinearLayout&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This example creates a simple registration screen.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Design View and Code View<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Android Studio provides multiple editing modes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Design View<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Visual drag-and-drop interface.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Code View<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Displays XML source code.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Split View<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Shows both design and code simultaneously.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">These options make UI development easier.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Real-World Applications of XML Layouts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">XML layouts are used in:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Login screens<\/li>\n\n\n\n<li>Registration forms<\/li>\n\n\n\n<li>E-commerce apps<\/li>\n\n\n\n<li>Social media applications<\/li>\n\n\n\n<li>Banking apps<\/li>\n\n\n\n<li>Educational apps<\/li>\n\n\n\n<li>Dashboard interfaces<\/li>\n\n\n\n<li>Mobile games<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Every Android application relies on XML layouts.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common Beginner Mistakes<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Missing Closing Tags<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Incorrect:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;Button&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Correct:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;Button \/&gt;\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Incorrect Width and Height<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Every component must define:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>android:layout_width\nandroid:layout_height\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Duplicate IDs<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Each component should have a unique ID.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Excessive Nested Layouts<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Too many nested layouts reduce performance.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ConstraintLayout is often a better solution.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Best Practices<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When working with XML layouts:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use meaningful IDs<\/li>\n\n\n\n<li>Keep layouts organized<\/li>\n\n\n\n<li>Use resource files for strings and colors<\/li>\n\n\n\n<li>Minimize nested layouts<\/li>\n\n\n\n<li>Use ConstraintLayout when possible<\/li>\n\n\n\n<li>Maintain consistent spacing<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">These practices improve application quality and maintainability.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Importance of XML Layout Basics<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">XML layouts are important because they:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Define application interfaces<\/li>\n\n\n\n<li>Separate UI from logic<\/li>\n\n\n\n<li>Improve maintainability<\/li>\n\n\n\n<li>Support responsive design<\/li>\n\n\n\n<li>Simplify UI development<\/li>\n\n\n\n<li>Form the foundation of Android app design<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Every Android developer must understand XML layout fundamentals.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">XML Layout Basics provide the foundation for designing Android application user interfaces. By using XML files, developers can create organized, responsive, and visually appealing screens while keeping design separate from application logic. Understanding layouts, UI components, attributes, and layout containers is essential for building professional Android applications and creating a positive user experience.<\/p>\n\n\n<div class=\"yoast-breadcrumbs\"><span><span><a href=\"https:\/\/gigz.pk\/javaapp\">Home<\/a><\/span> \u00bb <span class=\"breadcrumb_last\" aria-current=\"page\">Java for Android Apps > Android UI Design > XML Layout Basics<\/span><\/span><\/div>\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><\/div>\n","protected":false},"menu_order":43,"template":"","class_list":["post-140","lesson","type-lesson","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>\u00a0XML Layout Basics - Learn Java used for Apps with GiGz.PK<\/title>\n<meta name=\"description\" content=\"Learn Android XML layout basics \u2014 TextView, Button, EditText, LinearLayout, ConstraintLayout, and key attributes with examples.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gigz.pk\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u00a0XML Layout Basics - Learn Java used for Apps with GiGz.PK\" \/>\n<meta property=\"og:description\" content=\"Learn Android XML layout basics \u2014 TextView, Button, EditText, LinearLayout, ConstraintLayout, and key attributes with examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/\" \/>\n<meta property=\"og:site_name\" content=\"Learn Java used for Apps with GiGz.PK\" \/>\n<meta property=\"article:modified_time\" content=\"2026-06-06T11:18:14+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\\\/\\\/gigz.pk\\\/javaapp\\\/?lesson=xml-layout-basics\",\"url\":\"https:\\\/\\\/gigz.pk\\\/\",\"name\":\"\u00a0XML Layout Basics - Learn Java used for Apps with GiGz.PK\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/javaapp\\\/#website\"},\"datePublished\":\"2026-06-03T06:17:32+00:00\",\"dateModified\":\"2026-06-06T11:18:14+00:00\",\"description\":\"Learn Android XML layout basics \u2014 TextView, Button, EditText, LinearLayout, ConstraintLayout, and key attributes with examples.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/javaapp\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java for Android Apps > Android UI Design > XML Layout Basics\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/javaapp\\\/#website\",\"url\":\"https:\\\/\\\/gigz.pk\\\/javaapp\\\/\",\"name\":\"Learn Java used for Apps with GiGz.PK\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gigz.pk\\\/javaapp\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u00a0XML Layout Basics - Learn Java used for Apps with GiGz.PK","description":"Learn Android XML layout basics \u2014 TextView, Button, EditText, LinearLayout, ConstraintLayout, and key attributes with examples.","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:\/\/gigz.pk\/","og_locale":"en_US","og_type":"article","og_title":"\u00a0XML Layout Basics - Learn Java used for Apps with GiGz.PK","og_description":"Learn Android XML layout basics \u2014 TextView, Button, EditText, LinearLayout, ConstraintLayout, and key attributes with examples.","og_url":"https:\/\/gigz.pk\/","og_site_name":"Learn Java used for Apps with GiGz.PK","article_modified_time":"2026-06-06T11:18:14+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["WebPage","FAQPage"],"@id":"https:\/\/gigz.pk\/javaapp\/?lesson=xml-layout-basics","url":"https:\/\/gigz.pk\/","name":"\u00a0XML Layout Basics - Learn Java used for Apps with GiGz.PK","isPartOf":{"@id":"https:\/\/gigz.pk\/javaapp\/#website"},"datePublished":"2026-06-03T06:17:32+00:00","dateModified":"2026-06-06T11:18:14+00:00","description":"Learn Android XML layout basics \u2014 TextView, Button, EditText, LinearLayout, ConstraintLayout, and key attributes with examples.","breadcrumb":{"@id":"https:\/\/gigz.pk\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/javaapp"},{"@type":"ListItem","position":2,"name":"Java for Android Apps > Android UI Design > XML Layout Basics"}]},{"@type":"WebSite","@id":"https:\/\/gigz.pk\/javaapp\/#website","url":"https:\/\/gigz.pk\/javaapp\/","name":"Learn Java used for Apps with GiGz.PK","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gigz.pk\/javaapp\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/gigz.pk\/javaapp\/index.php?rest_route=\/wp\/v2\/lesson\/140","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gigz.pk\/javaapp\/index.php?rest_route=\/wp\/v2\/lesson"}],"about":[{"href":"https:\/\/gigz.pk\/javaapp\/index.php?rest_route=\/wp\/v2\/types\/lesson"}],"wp:attachment":[{"href":"https:\/\/gigz.pk\/javaapp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}