{"id":1064,"date":"2024-11-14T09:11:26","date_gmt":"2024-11-14T09:11:26","guid":{"rendered":"https:\/\/www.freelifemakers.org\/wordpress\/?p=1064"},"modified":"2024-11-14T09:34:06","modified_gmt":"2024-11-14T09:34:06","slug":"2-fragment-part","status":"publish","type":"post","link":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/2024\/11\/14\/2-fragment-part\/","title":{"rendered":"[Kotlin]Drawerlayout &#8211; 2.\ud504\ub808\uadf8\uba3c\ud2b8\ubd80\ubd84(Fragment Part)"},"content":{"rendered":"\n<p><strong>1.Fragment1.kt<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package com.example.drawerex\n\nimport android.os.Bundle\nimport androidx.fragment.app.Fragment\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\n\n\nclass Fragment1 : Fragment() {\n\n    override fun onCreateView(\n        inflater: LayoutInflater, container: ViewGroup?,\n        savedInstanceState: Bundle?\n    ): View? {\n        \/\/ Inflate the layout for this fragment\n        return inflater.inflate(R.layout.fragment_1, container, false)\n    }\n\n}<\/code><\/pre>\n\n\n\n<p><strong>1-1.fragment_1.xml<\/strong><\/p>\n\n\n\n<p>-xml design<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"384\" height=\"670\" src=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2024\/11\/Fragment1.png\" alt=\"\" class=\"wp-image-1065\" srcset=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2024\/11\/Fragment1.png 384w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2024\/11\/Fragment1-172x300.png 172w\" sizes=\"auto, (max-width: 384px) 100vw, 384px\" \/><\/figure>\n\n\n\n<p>-xml code<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;FrameLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    xmlns:tools=\"http:\/\/schemas.android.com\/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:background=\"#8BC34A\"&gt;\n\n    &lt;TextView\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"Fragment1\"\n        android:textSize=\"20sp\" \/&gt;\n\n&lt;\/FrameLayout&gt;<\/code><\/pre>\n\n\n\n<p><strong>2.Fragment2.kt<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package com.example.drawerex\n\nimport android.os.Bundle\nimport androidx.fragment.app.Fragment\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\n\n\nclass Fragment2 : Fragment() {\n\n\n    override fun onCreateView(\n        inflater: LayoutInflater, container: ViewGroup?,\n        savedInstanceState: Bundle?\n    ): View? {\n        \/\/ Inflate the layout for this fragment\n        return inflater.inflate(R.layout.fragment_2, container, false)\n    }\n\n}<\/code><\/pre>\n\n\n\n<p><strong>2-1.fragment_2.xml<\/strong><\/p>\n\n\n\n<p>-xml design<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"384\" height=\"670\" src=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2024\/11\/Fragment2.png\" alt=\"\" class=\"wp-image-1066\" srcset=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2024\/11\/Fragment2.png 384w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2024\/11\/Fragment2-172x300.png 172w\" sizes=\"auto, (max-width: 384px) 100vw, 384px\" \/><\/figure>\n\n\n\n<p>-xml code<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;FrameLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    xmlns:tools=\"http:\/\/schemas.android.com\/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:background=\"#FFEB3B\"&gt;\n\n\n    &lt;TextView\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"Fragment2\"\n        android:textSize=\"20sp\" \/&gt;\n\n&lt;\/FrameLayout&gt;<\/code><\/pre>\n\n\n\n<p><strong>3.Fragment3.kt<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package com.example.drawerex\n\nimport android.os.Bundle\nimport androidx.fragment.app.Fragment\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\n\n\nclass Fragment3 : Fragment() {\n\n    override fun onCreateView(\n        inflater: LayoutInflater, container: ViewGroup?,\n        savedInstanceState: Bundle?\n    ): View? {\n        \/\/ Inflate the layout for this fragment\n        return inflater.inflate(R.layout.fragment_3, container, false)\n    }\n\n}<\/code><\/pre>\n\n\n\n<p><strong>3-1.fragment_3.xml<\/strong><\/p>\n\n\n\n<p>-xml design<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"380\" height=\"671\" src=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2024\/11\/Fragment3.png\" alt=\"\" class=\"wp-image-1067\" srcset=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2024\/11\/Fragment3.png 380w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2024\/11\/Fragment3-170x300.png 170w\" sizes=\"auto, (max-width: 380px) 100vw, 380px\" \/><\/figure>\n\n\n\n<p>-xml code<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package com.example.drawerex\n\nimport android.os.Bundle\nimport androidx.fragment.app.Fragment\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\n\n\nclass Fragment3 : Fragment() {\n\n    override fun onCreateView(\n        inflater: LayoutInflater, container: ViewGroup?,\n        savedInstanceState: Bundle?\n    ): View? {\n        \/\/ Inflate the layout for this fragment\n        return inflater.inflate(R.layout.fragment_3, container, false)\n    }\n\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1.Fragment1.kt 1-1.fragment_1.xml -xml design -xml code 2.Fragment2.kt 2-1.fragment_2.xml -xml design -xml code 3.Fragment3.kt 3-1.fragment_3.xml -xml design -xml code<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,1],"tags":[],"class_list":["post-1064","post","type-post","status-publish","format-standard","hentry","category-kotlin","category-uncategorized","missing-thumbnail"],"_links":{"self":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/1064","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=1064"}],"version-history":[{"count":3,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/1064\/revisions"}],"predecessor-version":[{"id":1071,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/1064\/revisions\/1071"}],"wp:attachment":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=1064"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=1064"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=1064"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}