{"id":962,"date":"2026-01-31T11:28:42","date_gmt":"2026-01-31T11:28:42","guid":{"rendered":"https:\/\/nurlandroid.com\/?p=962"},"modified":"2026-01-31T11:28:45","modified_gmt":"2026-01-31T11:28:45","slug":"%d0%b2-%d1%87%d1%91%d0%bc-%d0%bf%d1%80%d0%b8%d0%bd%d1%86%d0%b8%d0%bf%d0%b8%d0%b0%d0%bb%d1%8c%d0%bd%d0%be%d0%b5-%d0%be%d1%82%d0%bb%d0%b8%d1%87%d0%b8%d0%b5-jetpack-compose-%d0%be%d1%82-view-%d1%81%d0%b8","status":"publish","type":"post","link":"https:\/\/nurlandroid.com\/?p=962","title":{"rendered":"\u0412 \u0447\u0451\u043c \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 Jetpack Compose \u043e\u0442 View-\u0441\u0438\u0441\u0442\u0435\u043c\u044b? \u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0440\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f?"},"content":{"rendered":"\n<p>Jetpack Compose \u2014 \u044d\u0442\u043e <strong>\u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u0430\u044f UI-\u0441\u0438\u0441\u0442\u0435\u043c\u0430<\/strong>, \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0430\u044f\u0441\u044f \u043e\u0442 <strong>\u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 View-\u0441\u0438\u0441\u0442\u0435\u043c\u044b Android<\/strong>. \u042d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043c\u0435\u043d\u0430 <code>TextView<\/code> \u043d\u0430 <code>Text()<\/code> \u2014 \u044d\u0442\u043e <strong>\u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043c\u044b\u0448\u043b\u0435\u043d\u0438\u044f \u0438 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 UI<\/strong>.<\/p>\n\n\n\n<p>\u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u044d\u0442\u043e <strong>&#171;\u0414\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c&#187;<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u0412 View \u0442\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u0448\u044c: <em>&#171;\u043d\u0430\u0439\u0434\u0438 \u043a\u043d\u043e\u043f\u043a\u0443 \u0438 \u0438\u0437\u043c\u0435\u043d\u0438 \u0442\u0435\u043a\u0441\u0442&#187;<\/em><\/li>\n\n\n\n<li>\u0412 Compose \u0442\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u0448\u044c: <em>&#171;\u0435\u0441\u043b\u0438 \u0441\u0442\u0435\u0439\u0442 \u0442\u0430\u043a\u043e\u0439 \u2014 \u043f\u043e\u043a\u0430\u0436\u0438 \u0442\u0430\u043a\u043e\u0439 UI&#187;<\/em><\/li>\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Compose \u043a\u0430\u043a \u0431\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u0442: &#171;\u0415\u0441\u043b\u0438 \u0443 \u0442\u0435\u0431\u044f \u043d\u043e\u0432\u044b\u0439 <code>state<\/code>, \u0442\u043e \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u0443\u0439 UI \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d <strong>\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b<\/strong> \u0435\u043c\u0443. \u041d\u0435 \u0432\u0430\u0436\u043d\u043e, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0440\u0430\u043d\u044c\u0448\u0435.&#187;<\/p>\n<\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\">\u041f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u044f Compose vs View-\u0441\u0438\u0441\u0442\u0435\u043c\u0430<\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><\/th><th>View-\u0441\u0438\u0441\u0442\u0435\u043c\u0430 (imperative)<\/th><th>Jetpack Compose (declarative)<\/th><\/tr><\/thead><tbody><tr><td><strong>\u041f\u043e\u0434\u0445\u043e\u0434 \u043a UI<\/strong><\/td><td>\u00ab\u0421\u043e\u0437\u0434\u0430\u0439 \u0438 \u043f\u043e\u0442\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u044f\u0439\u00bb<\/td><td>\u00ab\u041e\u043f\u0438\u0448\u0438, \u043a\u0430\u043a\u0438\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c UI \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0441\u0442\u0435\u0439\u0442\u0435\u00bb<\/td><\/tr><tr><td><strong>UI \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f<\/strong><\/td><td>1 \u0440\u0430\u0437 (inflate) \u0438 \u043f\u043e\u0442\u043e\u043c <strong>\u043c\u0443\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f<\/strong><\/td><td>\u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 <strong>\u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043d\u043e\u0432\u043e<\/strong><\/td><\/tr><tr><td><strong>\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435<\/strong><\/td><td>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 <code>ViewModel<\/code>, <code>LiveData<\/code>, <code>View<\/code><\/td><td>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>remember<\/code>, <code>mutableStateOf()<\/code><\/td><\/tr><tr><td><strong>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f<\/strong><\/td><td>\u0432\u0440\u0443\u0447\u043d\u0443\u044e: <code>view.text = \"new\"<\/code><\/td><td>\u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438: <code>state \u2192 recomposition<\/code><\/td><\/tr><tr><td><strong>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/strong><\/td><td>\u0417\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 <code>View<\/code>, layout passes<\/td><td>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 slot table, skipping, smart diffs<\/td><\/tr><tr><td><strong>\u0416\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b<\/strong><\/td><td>\u0421\u043b\u043e\u0436\u043d\u044b\u0439: <code>onAttach<\/code>, <code>onDetach<\/code>, <code>onMeasure<\/code>&#8230;<\/td><td>\u041f\u0440\u043e\u0441\u0442\u043e\u0439: <code>@Composable<\/code> \u2192 <code>recomposition<\/code><\/td><\/tr><tr><td><strong>\u0421\u043e\u0431\u044b\u0442\u0438\u044f UI<\/strong><\/td><td><code>setOnClickListener<\/code>, <code>setText()<\/code><\/td><td><code>onClick = {}<\/code> \u0432 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u0442\u0438\u043b\u0435<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 <strong>\u0440\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f<\/strong> \u0432 Compose<\/h4>\n\n\n\n<p>\u0420\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f \u2014 \u044d\u0442\u043e <strong>\u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u0447\u0430\u0441\u0442\u0438 UI<\/strong>, \u043a\u043e\u0433\u0434\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435. Compose <strong>\u043d\u0435 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0432\u0435\u0441\u044c \u044d\u043a\u0440\u0430\u043d<\/strong>, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e <strong>\u0442\u0435 \u0447\u0430\u0441\u0442\u0438<\/strong>, \u0433\u0434\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f <code>state<\/code>. \u0417\u0430 \u044d\u0442\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 <strong>Slot table<\/strong> \u2014 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u044e\u0449\u0430\u044f <strong>\u0433\u0434\u0435 \u0438 \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0432\u044b\u0437\u0432\u0430\u043d\u043e<\/strong>. Compose \u0443\u043c\u0435\u0435\u0442 <strong>\u0441\u043a\u0438\u043f\u0430\u0442\u044c<\/strong> \u0432\u044b\u0437\u043e\u0432\u044b, \u0435\u0441\u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438\u0441\u044c (\u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 <code>remember<\/code>, <code>key<\/code>, <code>derivedStateOf<\/code>, etc.).<\/p>\n\n\n\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n@Composable\nfun Counter() {\n    var count by remember { mutableStateOf(0) }\n\n    Column {\n        Text(&quot;Clicked $count times&quot;)\n        Button(onClick = { count++ }) {\n            Text(&quot;Click me&quot;)\n        }\n    }\n}\n<\/pre><\/div>\n\n\n<p>\u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><code>count++<\/code> \u043c\u0435\u043d\u044f\u0435\u0442 <code>State&lt;Int><\/code><\/li>\n\n\n\n<li>Compose \u0437\u0430\u043c\u0435\u0447\u0430\u0435\u0442, \u0447\u0442\u043e <code>count<\/code> \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f<\/li>\n\n\n\n<li>\u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <code>Counter()<\/code> \u0437\u0430\u043d\u043e\u0432\u043e<\/li>\n\n\n\n<li>\u0422\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0432\u0448\u0438\u0435\u0441\u044f \u0443\u0437\u043b\u044b (\u0442.\u0435. <code>Text(\"Clicked...)<\/code>) \u0431\u0443\u0434\u0443\u0442 <strong>\u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u043d\u044b<\/strong><\/li>\n\n\n\n<li>\u041a\u043d\u043e\u043f\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 <strong>\u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u0430 (skipped)<\/strong> \u2014 \u043e\u043d\u0430 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 <code>count<\/code><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Jetpack Compose \u2014 \u044d\u0442\u043e \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u0430\u044f UI-\u0441\u0438\u0441\u0442\u0435\u043c\u0430, \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0430\u044f\u0441\u044f \u043e\u0442 \u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 View-\u0441\u0438\u0441\u0442\u0435\u043c\u044b Android. \u042d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043c\u0435\u043d\u0430 TextView \u043d\u0430 Text() \u2014 \u044d\u0442\u043e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043c\u044b\u0448\u043b\u0435\u043d\u0438\u044f \u0438 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 UI. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u044d\u0442\u043e &#171;\u0414\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c&#187; Compose \u043a\u0430\u043a \u0431\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u0442: &#171;\u0415\u0441\u043b\u0438 \u0443 \u0442\u0435\u0431\u044f \u043d\u043e\u0432\u044b\u0439 state, \u0442\u043e \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u0443\u0439 UI \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0435\u043c\u0443. \u041d\u0435 \u0432\u0430\u0436\u043d\u043e, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0440\u0430\u043d\u044c\u0448\u0435.&#187; \u041f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u044b\u0435 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,32],"tags":[],"class_list":["post-962","post","type-post","status-publish","format-standard","hentry","category-android","category-compose"],"_links":{"self":[{"href":"https:\/\/nurlandroid.com\/index.php?rest_route=\/wp\/v2\/posts\/962","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nurlandroid.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nurlandroid.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nurlandroid.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nurlandroid.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=962"}],"version-history":[{"count":1,"href":"https:\/\/nurlandroid.com\/index.php?rest_route=\/wp\/v2\/posts\/962\/revisions"}],"predecessor-version":[{"id":963,"href":"https:\/\/nurlandroid.com\/index.php?rest_route=\/wp\/v2\/posts\/962\/revisions\/963"}],"wp:attachment":[{"href":"https:\/\/nurlandroid.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=962"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nurlandroid.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=962"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nurlandroid.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=962"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}