{"id":1402,"date":"2019-07-24T12:17:29","date_gmt":"2019-07-24T03:17:29","guid":{"rendered":"https:\/\/www.charlezz.com\/?p=1402"},"modified":"2020-06-16T17:41:54","modified_gmt":"2020-06-16T08:41:54","slug":"%ec%84%b8%eb%a1%9c%ed%98%95-recyclerview-%ec%95%88%ec%97%90-%ea%b0%80%eb%a1%9c%ed%98%95-recyclerview-%ea%b5%ac%ed%98%84%ed%95%a0-%eb%95%8c-%ec%8a%a4%ed%81%ac%eb%a1%a4%ec%9d%b4-%ec%9e%98-%eb%90%98","status":"publish","type":"post","link":"https:\/\/charlezz.com\/?p=1402","title":{"rendered":"\uc138\ub85c\ud615 RecyclerView \uc548\uc5d0 \uac00\ub85c\ud615 RecyclerView \uad6c\ud604\ud560 \ub54c \uc2a4\ud06c\ub864\uc774 \uc798 \ub418\uc9c0 \uc54a\uc744\ub54c"},"content":{"rendered":"<p><img decoding=\"async\" loading=\"lazy\" width=\"460\" height=\"780\" src=\"https:\/\/www.charlezz.com\/wordpress\/wp-content\/uploads\/2019\/07\/drawit-diagram.png\" class=\"aligncenter wp-image-1403\" alt=\"\" title=\"drawit diagram\" srcset=\"https:\/\/www.charlezz.com\/wordpress\/wp-content\/uploads\/2019\/07\/drawit-diagram.png 460w, https:\/\/www.charlezz.com\/wordpress\/wp-content\/uploads\/2019\/07\/drawit-diagram-177x300.png 177w\" sizes=\"(max-width: 460px) 100vw, 460px\" \/><\/p>\n<h2>\uc2a4\ud06c\ub864\uc774 \uc798 \ub418\uc9c0 \uc54a\uc544\uc694!!<\/h2>\n<p>Vertical RecyclerView\uc548\uc5d0 Horizontal RecyclerView\ub97c \uad6c\ud604\ud558\ub294 \uacbd\uc6b0 \uc2a4\ud06c\ub864\uc774 \uc798\ub418\uc9c0 \uc54a\ub294 \uacbd\uc6b0\uac00 \ubc1c\uc0dd\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<p>\uc0c1\uc704\/\ud558\uc704 RecyclerView \uc0c1\ud638\uac04 \ud130\uce58\uc774\ubca4\ud2b8 \uac04\uc12d\uc73c\ub85c \uc778\ud574 \uc6d0\uce58 \uc54a\ub294 \ub3d9\uc791\uc774 \ubc1c\uc0dd\uae30 \ub54c\ubb38\uc778\ub370\uc694.<\/p>\n<p>RecyclerView\ub294\u00a0<span>NestedScrollingChild \uc778\ud130\ud398\uc774\uc2a4\uc758 \uad6c\ud604\uc73c\ub85c \uc911\ucca9\ub41c \uc2a4\ud06c\ub864(nested scroll)\uc5d0 \ub300\ud55c \ub0b4\uc6a9\uc744 \uc9c0\uc6d0\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4. RecyclerView\uac00 \ucd08\uae30\ud654 \ub418\uace0 \uc911\ucca9\uc2a4\ud06c\ub864\uc5d0 \ub300\ud55c \uae30\ub2a5\uc774 true\ub85c \ub418\uc5b4\uc788\ub294\ub370 \uc774\ub97c \ube44\ud65c\uc131\ud654 \ud574\uc8fc\uba74 \ubb38\uc81c\uac00 \ud574\uacb0\ub429\ub2c8\ub2e4.\u00a0<\/span><\/p>\n<p>\ub610\ud55c CoordinatorLayout\uc744 \uc0ac\uc6a9\ud558\uba74\uc11c CollapsingToolbarLayout\uacfc AppBarBehavior\ub97c \uc0ac\uc6a9\ud558\ub294 \uacbd\uc6b0\uc758 \uc2a4\ud06c\ub864 \uc624\ub3d9\uc791\ub3c4 \ub9c8\ucc2c\uac00\uc9c0\ub85c \ud558\uc704 RecyclerView\uc758 <span><strong>setNestedScrollingEnabled(false);<\/strong> \ub97c \ud638\ucd9c\ud558\uba74 \ud574\uacb0\uc774 \ub429\ub2c8\ub2e4.<\/span><\/p>\n<hr \/>\n<p>19.08.19 \ucd94\uac00\u00a0<br \/>\n\uc6d0\ubb38 : https:\/\/rubensousa.com\/2019\/08\/16\/nested_recyclerview_part1\/<br \/>\n<span class=\"mce-shim\"><\/span><span class=\"wpview-end\"><\/span><\/p>\n<p>\uae30\ubcf8 RecyclerView \uc0ac\uc6a9\uc2dc \uc544\ub798\uc640 \uac19\uc740 \uc2a4\ud06c\ub864 \uc774\uc288\uac00 \ubc1c\uc0dd\ud569\ub2c8\ub2e4.<\/p>\n<h2>\ubb38\uc81c 1 \uc601\uc0c1<\/h2>\n<div style=\"width: 720px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]--><br \/>\n<video class=\"wp-video-shortcode\" id=\"video-1402-1\" width=\"720\" height=\"1280\" autoplay=\"1\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/webm\" src=\"https:\/\/www.charlezz.com\/wordpress\/wp-content\/uploads\/2019\/07\/nested_problem1.webm?_=1\" \/><a href=\"https:\/\/www.charlezz.com\/wordpress\/wp-content\/uploads\/2019\/07\/nested_problem1.webm\">https:\/\/www.charlezz.com\/wordpress\/wp-content\/uploads\/2019\/07\/nested_problem1.webm<\/a><\/video><\/div>\n<h3>\ubb38\uc81c2 \uc601\uc0c1<\/h3>\n<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-1402-2\" width=\"720\" height=\"1280\" autoplay=\"1\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/webm\" src=\"https:\/\/www.charlezz.com\/wordpress\/wp-content\/uploads\/2019\/07\/nested_problem2_fix.webm?_=2\" \/><a href=\"https:\/\/www.charlezz.com\/wordpress\/wp-content\/uploads\/2019\/07\/nested_problem2_fix.webm\">https:\/\/www.charlezz.com\/wordpress\/wp-content\/uploads\/2019\/07\/nested_problem2_fix.webm<\/a><\/video><\/div>\n<p>&nbsp;<\/p>\n<h2>\uc218\uc815\ud558\ub294 \ubc29\ubc95<\/h2>\n<p>\ub450 \uc601\uc0c1\uc5d0\uc11c \ubcf4\uc774\ub294 \uc774\uc288\ub97c \ubaa8\ub450 \ud574\uacb0\ud558\uae30 \uc704\ud574\uc11c\ub294 RecyclerView\ub97c \uc0c1\uc18d\ud55c <a href=\"https:\/\/github.com\/rubensousa\/RecyclerViewSnap\/blob\/master\/gravitysnaphelper\/src\/main\/java\/com\/github\/rubensousa\/gravitysnaphelper\/OrientationAwareRecyclerView.java\">OrientationAwareRecyclerView<\/a>\ub97c \ub9cc\ub4e4\uace0 <strong>onInterceptTouchEvent<\/strong>\ub97c \uc7ac\uc815\uc758 \ud574\uc57c\ud569\ub2c8\ub2e4.<\/p>\n<p>\uc0ac\uc6a9\uc790\uac00 \uc190\uac00\ub77d\uc744 \uc6c0\uc9c8\uc77c\ub54c\uc758 \uc2a4\ud06c\ub864 \ubc29\ud5a5\uc774 RecyclerView\uc758 \ubc29\ud5a5\uc778\uc9c0 \ud655\uc778\ud574\uc57c\ud558\ub294\ub370, \ub9cc\uc57d \ubc29\ud5a5\uc774 \uc77c\uce58\ud55c\ub2e4\uba74 \ud130\uce58\uc774\ubca4\ud2b8\ub97c \uac00\ub85c\ucc44\uace0 \uc544\ub2c8\uba74 \uadf8\ub300\ub85c \ub3d9\uc791\ud558\uac8c \ub0b4\ubc84\ub824\ub461\ub2c8\ub2e4.<\/p>\n<pre class=\"lang:java decode:true\">@Override\r\npublic boolean onInterceptTouchEvent(MotionEvent e) {\r\n   final LayoutManager lm = getLayoutManager();\r\n\r\n   if (lm == null) {\r\n       return super.onInterceptTouchEvent(e);\r\n   }\r\n\r\n   boolean allowScroll = true;\r\n\r\n   switch (e.getActionMasked()) {\r\n       case MotionEvent.ACTION_DOWN: {\r\n           lastX = e.getX();\r\n           lastY = e.getY();\r\n           \/\/ If we were scrolling, stop now by faking a touch release\r\n           if (scrolling) {\r\n               MotionEvent newEvent = MotionEvent.obtain(e);\r\n               newEvent.setAction(MotionEvent.ACTION_UP);\r\n               return super.onInterceptTouchEvent(newEvent);\r\n           }\r\n           break;\r\n       }\r\n       case MotionEvent.ACTION_MOVE: {\r\n           \/\/ We're moving, so check if we're trying\r\n           \/\/ to scroll vertically or horizontally\r\n           \/\/ so we don't intercept the wrong event.\r\n           float currentX = e.getX();\r\n           float currentY = e.getY();\r\n           float dx = Math.abs(currentX - lastX);\r\n           float dy = Math.abs(currentY - lastY);\r\n           allowScroll = dy &gt; dx ? lm.canScrollVertically() : lm.canScrollHorizontally();\r\n           break;\r\n       }\r\n   }\r\n\r\n   if (!allowScroll) {\r\n       return false;\r\n   }\r\n\r\n   return super.onInterceptTouchEvent(e);\r\n}<\/pre>\n<p>\uc704\uc758 \ucf54\ub4dc\ub97c \uc801\uc6a9\ud558\uc5ec \ubb38\uc81c\uc810\uc744 \ud574\uacb0\ud55c \uc601\uc0c1\uc744 \uc544\ub798\uc5d0\uc11c \ud655\uc778\ud574\ubcf4\uc138\uc694.<\/p>\n<h2>\ud574\uacb01 \uc601\uc0c1<\/h2>\n<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-1402-3\" width=\"720\" height=\"1280\" autoplay=\"1\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/webm\" src=\"https:\/\/www.charlezz.com\/wordpress\/wp-content\/uploads\/2019\/07\/nested_problem1_fix.webm?_=3\" \/><a href=\"https:\/\/www.charlezz.com\/wordpress\/wp-content\/uploads\/2019\/07\/nested_problem1_fix.webm\">https:\/\/www.charlezz.com\/wordpress\/wp-content\/uploads\/2019\/07\/nested_problem1_fix.webm<\/a><\/video><\/div>\n<h2>\ud574\uacb02 \uc601\uc0c1<\/h2>\n<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-1402-4\" width=\"720\" height=\"1280\" autoplay=\"1\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/webm\" src=\"https:\/\/www.charlezz.com\/wordpress\/wp-content\/uploads\/2019\/07\/nested_problem2_fix-1.webm?_=4\" \/><a href=\"https:\/\/www.charlezz.com\/wordpress\/wp-content\/uploads\/2019\/07\/nested_problem2_fix-1.webm\">https:\/\/www.charlezz.com\/wordpress\/wp-content\/uploads\/2019\/07\/nested_problem2_fix-1.webm<\/a><\/video><\/div>\n<p>\uc6d0\ubb38 \ucd9c\ucc98\uc758 \uc0d8\ud50c\u00a0<span>Github:<\/span><a href=\"https:\/\/github.com\/rubensousa\/RecyclerViewNestedExample\/\">https:\/\/github.com\/rubensousa\/RecyclerViewNestedExample\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uc2a4\ud06c\ub864\uc774 \uc798 \ub418\uc9c0 \uc54a\uc544\uc694!! Vertical RecyclerView\uc548\uc5d0 Horizontal RecyclerView\ub97c \uad6c\ud604\ud558\ub294 \uacbd\uc6b0 \uc2a4\ud06c\ub864\uc774 \uc798\ub418\uc9c0 \uc54a\ub294 \uacbd\uc6b0\uac00 \ubc1c\uc0dd\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc0c1\uc704\/\ud558\uc704 RecyclerView \uc0c1\ud638\uac04 \ud130\uce58\uc774\ubca4\ud2b8 \uac04\uc12d\uc73c\ub85c \uc778\ud574 \uc6d0\uce58 \uc54a\ub294 \ub3d9\uc791\uc774 \ubc1c\uc0dd\uae30 \ub54c\ubb38\uc778\ub370\uc694. RecyclerView\ub294\u00a0NestedScrollingChild \uc778\ud130\ud398\uc774\uc2a4\uc758 \uad6c\ud604\uc73c\ub85c \uc911\ucca9\ub41c \uc2a4\ud06c\ub864(nested scroll)\uc5d0 \ub300\ud55c \ub0b4\uc6a9\uc744 \uc9c0\uc6d0\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4. RecyclerView\uac00 \ucd08\uae30\ud654 \ub418\uace0 \uc911\ucca9\uc2a4\ud06c\ub864\uc5d0 \ub300\ud55c \uae30\ub2a5\uc774 true\ub85c \ub418\uc5b4\uc788\ub294\ub370 \uc774\ub97c \ube44\ud65c\uc131\ud654 \ud574\uc8fc\uba74 \ubb38\uc81c\uac00 [&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\/1402"}],"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=1402"}],"version-history":[{"count":5,"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/posts\/1402\/revisions"}],"predecessor-version":[{"id":44306,"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/posts\/1402\/revisions\/44306"}],"wp:attachment":[{"href":"https:\/\/charlezz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/charlezz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1402"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/charlezz.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}