{"id":416,"date":"2018-06-25T22:18:27","date_gmt":"2018-06-25T13:18:27","guid":{"rendered":"http:\/\/www.charlezz.com\/?p=416"},"modified":"2020-11-05T16:38:25","modified_gmt":"2020-11-05T07:38:25","slug":"navigation-component%ec%9d%98-%ed%95%9c%ea%b3%84","status":"publish","type":"post","link":"https:\/\/charlezz.com\/?p=416","title":{"rendered":"Navigation Component\uc758 \ud55c\uacc4"},"content":{"rendered":"<p>\ub354 \uc774\uc0c1 Navigation Component\uc5d0 \ud55c\uacc4\ub294 \uc5c6\uc5b4\ubcf4\uc785\ub2c8\ub2e4.<\/p>\n<ul>\n<li>Dagger \uc774\uc288\ub294 Lazy \uc778\uc81d\uc158\uc73c\ub85c \ud574\uacb0\uac00\ub2a5\ud569\ub2c8\ub2e4.<\/li>\n<li>SharedElementTransition\uc740 \uc774\uc81c \ub124\ube44\uac8c\uc774\uc158 \ucef4\ud3ec\ub10c\ud2b8\uc5d0\uc11c \uacf5\uc2dd\uc801\uc73c\ub85c \uc9c0\uc6d0\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<hr \/>\n<h1>Navigation Component\uc758 \ud55c\uacc4<\/h1>\n<h2>Dagger\uc640 Databinding \uadf8\ub9ac\uace0 fragment\uc758 \ucd08\uae30\ud654 \ubb38\uc81c<\/h2>\n<p>\uc5b4\ub5a4 \uc561\ud2f0\ube44\ud2f0\uac00 xml \ub808\uc774\uc544\uc6c3\uc744 dagger\ub97c \uc774\uc6a9\ud558\uc5ec \ubc14\uc778\ub529\uac1d\uccb4\ub97c \uc8fc\uc778\ud55c\ub2e4\uace0 \uac00\uc815\ud558\uc790. \uc774\ub54c \uc561\ud2f0\ube44\ud2f0\uc758 xml \ub808\uc774\uc544\uc6c3\ub0b4\uc5d0 &lt;fragment&gt; element\ub97c \uc368\uc11c \ud504\ub808\uadf8\uba3c\ud2b8\ub97c \ucd08\uae30\ud654 \ud558\ub294 \uacbd\uc6b0 \uc561\ud2f0\ube44\ud2f0\uc758 \ub808\uc774\uc544\uc6c3\uc870\ucc28\ub3c4 \uc778\ud50c\ub808\uc774\ud305\uc774 \ub05d\ub098\uc9c0 \uc54a\uc544 context\uac00 \uc5c6\ub294\uc0c1\ud0dc\uc5d0\uc11c fragment\ub97c \uc778\ud50c\ub808\uc774\ud305 \ud558\ub824\uace0\ud558\ub2c8 context \uad00\ub828\ud574\uc11c nullpointer exception\uc774 \ubc1c\uc0dd\ud55c\ub2e4.<br \/>\nMainActivity.kt<\/p>\n<pre class=\"lang:java decode:true \">class MainActivity : DaggerAppCompatActivity() {\r\n    ...\r\n    @Inject\r\n    lateinit var binding: MainActivityBinding\r\n    ....\r\n}<\/pre>\n<p>\u00a0<br \/>\nmain_activity.xml<\/p>\n<pre class=\"lang:xhtml decode:true \">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;layout&gt;\r\n    &lt;data&gt;\r\n    ...\r\n    &lt;\/data&gt;\r\n    &lt;android.support.constraint.ConstraintLayout\r\n        xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n        xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"\r\n        xmlns:tools=\"http:\/\/schemas.android.com\/tools\"\r\n        android:layout_width=\"match_parent\"\r\n        android:layout_height=\"match_parent\"&gt;\r\n        &lt;fragment\r\n            android:layout_width=\"match_parent\"\r\n            android:layout_height=\"match_parent\"\r\n            android:id=\"@+id\/my_nav_host_fragment\"\r\n            android:name=\"androidx.navigation.fragment.NavHostFragment\"\r\n            app:navGraph=\"@navigation\/nav_graph\"\r\n            app:defaultNavHost=\"true\"\r\n            \/&gt;\r\n    &lt;\/android.support.constraint.ConstraintLayout&gt;\r\n&lt;\/layout&gt;<\/pre>\n<p>\u00a0<br \/>\n\ud574\uacb0\ucc45\uc740 &lt;fragment&gt; element\ub294 \uc0ac\uc6a9\ud560 \uc218\uac00 \uc5c6\uc73c\ub2c8 container\ub97c \uc0ac\uc6a9\ud558\uace0, \ud504\ub808\uadf8\uba3c\ud2b8 \ub9e4\ub2c8\uc800\ub97c \ud1b5\ud574 \ud2b8\ub79c\uc7ad\uc158\uc744 \ud55c\ub2e4.<br \/>\n\u00a0<br \/>\nMainActivity.kt<\/p>\n<pre class=\"lang:java decode:true \">class MainActivity : DaggerAppCompatActivity() {\r\n    ...\r\n    @Inject\r\n    lateinit var binding: MainActivityBinding\r\n    override fun onCreate(savedInstanceState: Bundle?) {\r\n        super.onCreate(savedInstanceState)\r\n        if (savedInstanceState == null) {\r\n            val navHostFragment = NavHostFragment.create(R.navigation.nav_graph)\r\n            supportFragmentManager.beginTransaction()\r\n                    .setPrimaryNavigationFragment(navHostFragment)\r\n                    .replace(R.id.container, navHostFragment)\r\n                    .commitNow()\r\n        }\r\n    }\r\n}<\/pre>\n<p>\u00a0<br \/>\nmain_activity.xml<\/p>\n<pre class=\"lang:xhtml decode:true \">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;layout&gt;\r\n    &lt;data&gt;\r\n    ...\r\n    &lt;\/data&gt;\r\n    &lt;android.support.constraint.ConstraintLayout\r\n        xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n        xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"\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=\".ui.card.CardActivity\"&gt;\r\n        &lt;FrameLayout\r\n            android:id=\"@+id\/container\"\r\n            android:layout_width=\"0dp\"\r\n            android:layout_height=\"0dp\"\r\n            app:layout_constraintBottom_toBottomOf=\"parent\"\r\n            app:layout_constraintLeft_toLeftOf=\"parent\"\r\n            app:layout_constraintRight_toRightOf=\"parent\"\r\n            app:layout_constraintTop_toTopOf=\"parent\"\/&gt;\r\n    &lt;\/android.support.constraint.ConstraintLayout&gt;\r\n&lt;\/layout&gt;<\/pre>\n<p>&nbsp;<\/p>\n<h2>Shared Element Transition \uc0ac\uc6a9 \ubd88\uac00\ub2a5<\/h2>\n<p>\ub124\ube44\uac8c\uc774\uc158 \ucef4\ud3ec\ub10c\ud2b8 \uc774\uc6a9\uc2dc \ud504\ub808\uadf8\uba3c\ud2b8\uac04\uc758 \ud654\uba74 \uc804\ud658\uc2dc \ud2b9\uc815\ubdf0\ub97c \uc790\uc5f0\uc2a4\ub7fd\uac8c \uc774\ub3d9\uc2dc\ud0a4\uac70\ub098 \ud655\ub300\uc2dc\ud0a4\ub294 Shared Element Transition\ub97c \uc774\uc6a9\ud560 \uc218\uac00 \uc5c6\ub2e4. \ud504\ub808\uadf8\uba3c\ud2b8 \ud2b8\ub79c\uc9c0\uc158\ub9cc \uc9c0\uc6d0\ud55c\ub2e4.<br \/>\nShared Element Transition\uc744 \uc774\uc6a9\ud558\uace0\uc790 \ud55c\ub2e4\uba74 Navigation\uc740 \uc7a0\uc2dc \uc811\uc5b4\ub450\ub3c4\ub85d\ud558\uc790.<br \/>\n\uc544\uc9c1 \uc54c\ud30c\ubc84\uc804\ub2e8\uacc4\uc774\ub2c8 \ucd94\ud6c4 Shared Element Transition\ub3c4 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\uc744\uae4c \ud558\uace0 \uae30\ub300\ud55c\ub2e4.<br \/>\n\u00a0<br \/>\n\uacb0\ub860 : \uc704\uc758 \ub450\uac00\uc9c0 \ud55c\uacc4\uac00 \uc788\ub2e4\ud558\ub354\ub77c\ub3c4 \uccab\ubc88\uc9f8 \uc774\uc288\ub294 \uc6b0\ud68c\uc801\uc73c\ub85c \ud574\uacb0\ud560 \uc218 \uc788\ub294 \ubc29\ubc95\uc774 \uc788\uc73c\uba70, UI-Flow\ub97c \ud55c\ub208\uc5d0 \ubcfc\uc218 \uc788\uace0 \ubc31\uc2a4\ud0dd \uad00\ub9ac\ub97c \ud560 \ud544\uc694\uc5c6\ub2e4\ub294 \uc810, \ub525\ub9c1\ud06c\uc790\uc5f0\uc2a4\ub7fd\uac8c \uc6c0\uc9c1\uc778\ub2e4\ub294 \uc810, NavigationView \uc640 NavigationDrawer\ub4f1 \ub2e4\ub978 \ucef4\ud3ec\ub10c\ud2b8\uc640\ub3c4 \uc798 \uc5b4\uc6b8\ub9ac\ub294\uc810 \ub4f1 \uc5ec\ub7ec\uac00\uc9c0 \uc7a5\uc810\uc774 \uc788\ub2e4. SharedElementTransition\ub9cc \uc544\ub2c8\ub77c\uba74 \uac1c\ubc1c\uc18d\ub3c4\uc640 \uc720\uc9c0\ubcf4\uc218\ub97c \uc704\ud574 \uc0ac\uc6a9\uc744 \uace0\ub824\ud574\ubcf4\ub294\uac83\ub3c4 \ub098\uc058\uc9c0 \uc54a\ub2e4.<\/p>\n<h1><a href=\"http:\/\/www.charlezz.com\/wordpress\/wp-content\/uploads\/2018\/06\/R720x0.q80.jpeg\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.charlezz.com\/wordpress\/wp-content\/uploads\/2018\/06\/R720x0.q80.jpeg\" alt=\"\" width=\"420\" height=\"331\" class=\"aligncenter size-full wp-image-418\" \/><\/a><\/h1>\n","protected":false},"excerpt":{"rendered":"<p>\ub354 \uc774\uc0c1 Navigation Component\uc5d0 \ud55c\uacc4\ub294 \uc5c6\uc5b4\ubcf4\uc785\ub2c8\ub2e4. Dagger \uc774\uc288\ub294 Lazy \uc778\uc81d\uc158\uc73c\ub85c \ud574\uacb0\uac00\ub2a5\ud569\ub2c8\ub2e4. SharedElementTransition\uc740 \uc774\uc81c \ub124\ube44\uac8c\uc774\uc158 \ucef4\ud3ec\ub10c\ud2b8\uc5d0\uc11c \uacf5\uc2dd\uc801\uc73c\ub85c \uc9c0\uc6d0\ud569\ub2c8\ub2e4. &nbsp; Navigation Component\uc758 \ud55c\uacc4 Dagger\uc640 Databinding \uadf8\ub9ac\uace0 fragment\uc758 \ucd08\uae30\ud654 \ubb38\uc81c \uc5b4\ub5a4 \uc561\ud2f0\ube44\ud2f0\uac00 xml \ub808\uc774\uc544\uc6c3\uc744 dagger\ub97c \uc774\uc6a9\ud558\uc5ec \ubc14\uc778\ub529\uac1d\uccb4\ub97c \uc8fc\uc778\ud55c\ub2e4\uace0 \uac00\uc815\ud558\uc790. \uc774\ub54c \uc561\ud2f0\ube44\ud2f0\uc758 xml \ub808\uc774\uc544\uc6c3\ub0b4\uc5d0 &lt;fragment&gt; element\ub97c \uc368\uc11c \ud504\ub808\uadf8\uba3c\ud2b8\ub97c \ucd08\uae30\ud654 \ud558\ub294 \uacbd\uc6b0 \uc561\ud2f0\ube44\ud2f0\uc758 \ub808\uc774\uc544\uc6c3\uc870\ucc28\ub3c4 \uc778\ud50c\ub808\uc774\ud305\uc774 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"inline_featured_image":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[16],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/posts\/416"}],"collection":[{"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/charlezz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=416"}],"version-history":[{"count":2,"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/posts\/416\/revisions"}],"predecessor-version":[{"id":44606,"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/posts\/416\/revisions\/44606"}],"wp:attachment":[{"href":"https:\/\/charlezz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/charlezz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/charlezz.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}