{"id":37013,"date":"2024-11-01T09:54:04","date_gmt":"2024-11-01T09:54:04","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=37013"},"modified":"2024-11-01T11:42:36","modified_gmt":"2024-11-01T11:42:36","slug":"course-on-kotlin-android-app-development-using-appbar","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/37013\/","title":{"rendered":"course on Kotlin Android App Development, Using AppBar"},"content":{"rendered":"<p><body><\/p>\n<p>In Android application development, the user interface (UI) is a crucial element that significantly affects user experience. Among these, the App Bar serves as the main navigation and access point of the application, intuitively providing users with important functionalities. In this post, we will delve into the concept of the App Bar, how to use it, and provide an implementation example using Kotlin.<\/p>\n<h2>What is an App Bar?<\/h2>\n<p>The App Bar is an element primarily used for user interaction within the application, displaying the title and actions. Typically, an App Bar consists of the following components:<\/p>\n<ul>\n<li><strong>Title:<\/strong> Displays the title of the current screen.<\/li>\n<li><strong>Navigation Icon:<\/strong> Displays icons for navigation, such as returning to the previous screen.<\/li>\n<li><strong>Action Icons:<\/strong> Displays icons for actions that the user can perform (e.g., search, add, delete, etc.).<\/li>\n<\/ul>\n<h3>Advantages of an App Bar<\/h3>\n<ul>\n<li>Clear Navigation: Helps users understand their current location and navigate easily.<\/li>\n<li>Consistent Design: Maintains the same style throughout the application.<\/li>\n<li>Easy Access to Tasks: Allows frequent functionalities to be quickly accessible.<\/li>\n<\/ul>\n<h2>Implementing an App Bar<\/h2>\n<p>In this section, we will look at how to implement an App Bar using Kotlin in Android Studio.<\/p>\n<h3>1. Create a Project<\/h3>\n<p>Run Android Studio and create a new app project. Select the <strong>Empty Activity<\/strong> template to set up the basic structure.<\/p>\n<h3>2. Configure Gradle<\/h3>\n<p>Check if the following library is included in your project&#8217;s <strong>build.gradle<\/strong> file:<\/p>\n<pre><code>implementation 'androidx.appcompat:appcompat:1.5.0'<\/code><\/pre>\n<h3>3. Create a Layout File<\/h3>\n<p>Edit the <strong>activity_main.xml<\/strong> file that composes the application&#8217;s UI to add the App Bar. Try using the following code:<\/p>\n<pre><code>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"\n    xmlns:tools=\"http:\/\/schemas.android.com\/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\".MainActivity\"&gt;\n\n    &lt;com.google.android.material.appbar.AppBarLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"&gt;\n\n        &lt;androidx.appcompat.widget.Toolbar\n            android:id=\"@+id\/toolbar\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"?attr\/actionBarSize\"\n            app:popupTheme=\"@style\/ThemeOverlay.AppCompat.Light\"\n            app:titleTextColor=\"@android:color\/white\"\n            android:background=\"@color\/purple_500\"\/&gt;\n\n    &lt;\/com.google.android.material.appbar.AppBarLayout&gt;\n\n    &lt;FrameLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"&gt;\n        &lt;!-- Add other UI elements here --&gt;\n    &lt;\/FrameLayout&gt;\n\n&lt;\/androidx.coordinatorlayout.widget.CoordinatorLayout&gt;<\/code><\/pre>\n<h3>4. Set Up MainActivity<\/h3>\n<p>Now, open the <strong>MainActivity.kt<\/strong> file and set up the App Bar as follows:<\/p>\n<pre><code>package com.example.myapplication\n\nimport androidx.appcompat.app.AppCompatActivity\nimport android.os.Bundle\nimport androidx.appcompat.widget.Toolbar\n\nclass MainActivity : AppCompatActivity() {\n\n    override fun onCreate(savedInstanceState: Bundle?) {\n        super.onCreate(savedInstanceState)\n        setContentView(R.layout.activity_main)\n\n        val toolbar: Toolbar = findViewById(R.id.toolbar)\n        setSupportActionBar(toolbar)\n        supportActionBar?.title = \"My App Title\"\n    }\n}<\/code><\/pre>\n<h3>5. Adding Menu Items<\/h3>\n<p>To add menu items to the App Bar, create a <strong>res\/menu<\/strong> directory and add a new XML file (<strong>menu_main.xml<\/strong>). Define the menu items as follows:<\/p>\n<pre><code>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;menu xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"&gt;\n    &lt;item\n        android:id=\"@+id\/action_settings\"\n        android:title=\"Settings\"\n        android:orderInCategory=\"100\"\n        android:showAsAction=\"never\" \/&gt;\n&lt;\/menu&gt;<\/code><\/pre>\n<h3>6. Connecting the Menu to Activity<\/h3>\n<p>Now, connect the menu items in the <strong>MainActivity.kt<\/strong> file:<\/p>\n<pre><code>override fun onCreateOptionsMenu(menu: Menu?): Boolean {\n    menuInflater.inflate(R.menu.menu_main, menu)\n    return true\n}\n\noverride fun onOptionsItemSelected(item: MenuItem): Boolean {\n    return when (item.itemId) {\n        R.id.action_settings -&gt; {\n            \/\/ Action upon clicking the settings menu\n            true\n        }\n        else -&gt; super.onOptionsItemSelected(item)\n    }\n}<\/code><\/pre>\n<h2>Conclusion<\/h2>\n<p>In this post, we examined the concept of the App Bar and how to implement it in Android applications. The App Bar is an essential element for providing a better user experience as users interact with the application. By following the steps outlined above, you can easily add an App Bar to your application.<\/p>\n<p>We will continue to provide in-depth content through various Android app development courses. Thank you!<\/p>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Android application development, the user interface (UI) is a crucial element that significantly affects user experience. Among these, the App Bar serves as the main navigation and access point of the application, intuitively providing users with important functionalities. In this post, we will delve into the concept of the App Bar, how to use &hellip; <a href=\"https:\/\/atmokpo.com\/w\/37013\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;course on Kotlin Android App Development, Using AppBar&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[143],"tags":[],"class_list":["post-37013","post","type-post","status-publish","format-standard","hentry","category-kotlin-android-app-development"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>course on Kotlin Android App Development, Using AppBar - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/atmokpo.com\/w\/37013\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"course on Kotlin Android App Development, Using AppBar - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"In Android application development, the user interface (UI) is a crucial element that significantly affects user experience. Among these, the App Bar serves as the main navigation and access point of the application, intuitively providing users with important functionalities. In this post, we will delve into the concept of the App Bar, how to use &hellip; \ub354 \ubcf4\uae30 &quot;course on Kotlin Android App Development, Using AppBar&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/37013\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:54:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:42:36+00:00\" \/>\n<meta name=\"author\" content=\"root\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:site\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"root\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"3\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/37013\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37013\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"course on Kotlin Android App Development, Using AppBar\",\"datePublished\":\"2024-11-01T09:54:04+00:00\",\"dateModified\":\"2024-11-01T11:42:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37013\/\"},\"wordCount\":398,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"Kotlin Android app development\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/37013\/\",\"url\":\"https:\/\/atmokpo.com\/w\/37013\/\",\"name\":\"course on Kotlin Android App Development, Using AppBar - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:54:04+00:00\",\"dateModified\":\"2024-11-01T11:42:36+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37013\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/37013\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/37013\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"course on Kotlin Android App Development, Using AppBar\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/atmokpo.com\/w\/#website\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/atmokpo.com\/w\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"contentUrl\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"width\":400,\"height\":400,\"caption\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\"},\"image\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/bebubo4\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\",\"name\":\"root\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"caption\":\"root\"},\"sameAs\":[\"http:\/\/atmokpo.com\/w\"],\"url\":\"https:\/\/atmokpo.com\/w\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"course on Kotlin Android App Development, Using AppBar - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","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:\/\/atmokpo.com\/w\/37013\/","og_locale":"ko_KR","og_type":"article","og_title":"course on Kotlin Android App Development, Using AppBar - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"In Android application development, the user interface (UI) is a crucial element that significantly affects user experience. Among these, the App Bar serves as the main navigation and access point of the application, intuitively providing users with important functionalities. In this post, we will delve into the concept of the App Bar, how to use &hellip; \ub354 \ubcf4\uae30 \"course on Kotlin Android App Development, Using AppBar\"","og_url":"https:\/\/atmokpo.com\/w\/37013\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:54:04+00:00","article_modified_time":"2024-11-01T11:42:36+00:00","author":"root","twitter_card":"summary_large_image","twitter_creator":"@bebubo4","twitter_site":"@bebubo4","twitter_misc":{"\uae00\uc4f4\uc774":"root","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"3\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/37013\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/37013\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"course on Kotlin Android App Development, Using AppBar","datePublished":"2024-11-01T09:54:04+00:00","dateModified":"2024-11-01T11:42:36+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/37013\/"},"wordCount":398,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["Kotlin Android app development"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/37013\/","url":"https:\/\/atmokpo.com\/w\/37013\/","name":"course on Kotlin Android App Development, Using AppBar - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:54:04+00:00","dateModified":"2024-11-01T11:42:36+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/37013\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/37013\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/37013\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"course on Kotlin Android App Development, Using AppBar"}]},{"@type":"WebSite","@id":"https:\/\/atmokpo.com\/w\/#website","url":"https:\/\/atmokpo.com\/w\/","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","description":"","publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/atmokpo.com\/w\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/atmokpo.com\/w\/#organization","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","url":"https:\/\/atmokpo.com\/w\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/","url":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","contentUrl":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","width":400,"height":400,"caption":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8"},"image":{"@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/bebubo4"]},{"@type":"Person","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7","name":"root","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","caption":"root"},"sameAs":["http:\/\/atmokpo.com\/w"],"url":"https:\/\/atmokpo.com\/w\/author\/root\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37013","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/comments?post=37013"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37013\/revisions"}],"predecessor-version":[{"id":37014,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37013\/revisions\/37014"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=37013"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=37013"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=37013"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}