{"id":383,"date":"2015-01-23T13:06:20","date_gmt":"2015-01-23T13:06:20","guid":{"rendered":"http:\/\/www.fandroid.info\/?p=383"},"modified":"2015-06-06T16:15:12","modified_gmt":"2015-06-06T16:15:12","slug":"urok-3-sozdanie-spiskov-kartochek-v-android-prilozheniyah-material-design","status":"publish","type":"post","link":"https:\/\/www.fandroid.info\/urok-3-sozdanie-spiskov-kartochek-v-android-prilozheniyah-material-design\/","title":{"rendered":"\u0423\u0440\u043e\u043a 3. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u0438 \u043a\u0430\u0440\u0442\u043e\u0447\u0435\u043a \u0432 android \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 \u0441 Material Design"},"content":{"rendered":"
<<<\u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0443\u0440\u043e\u043a<\/a><\/p>\n \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c \u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0442\u0430\u043a\u0436\u0435\u00a0\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f CardView \u0438 RecyclerView \u0432 Android<\/a><\/p>\n \u0412\u0438\u0434\u0436\u0435\u0442 RecyclerView<\/a> — \u0431\u043e\u043b\u0435\u0435 \u0443\u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0438 \u0433\u0438\u0431\u043a\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f ListView<\/a>. \u042d\u0442\u043e\u0442 \u0432\u0438\u0434\u0436\u0435\u0442 — \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u043a\u0440\u0443\u0447\u0435\u043d\u044b \u043e\u0447\u0435\u043d\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e view<\/strong>. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0432\u0438\u0434\u0436\u0435\u0442 RecyclerView<\/a>, \u043a\u043e\u0433\u0434\u0430 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439.<\/p>\n \u041a\u043b\u0430\u0441\u0441 RecyclerView<\/a> \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044f:<\/p>\n \u0412\u044b \u0442\u0430\u043a \u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c layout \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u044b \u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432 RecylerView<\/a>.<\/p>\n \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0438\u0434\u0436\u0435\u0442 RecyclerView<\/a>, \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0430\u0434\u0430\u043f\u0442\u0435\u0440 \u0438 layout<\/strong> \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440. \u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0430\u0434\u0430\u043f\u0442\u0435\u0440, \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0439\u0442\u0435\u0441\u044c \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 RecyclerView.Adapter<\/a>. \u0414\u0435\u0442\u0430\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0432\u0430\u0448\u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u0430 views<\/strong>. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0438\u0436\u0435.<\/p>\n Layout \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b view<\/strong> \u0432 RecyclerView<\/a> \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u0441\u043d\u043e\u0432\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b view<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0432\u0438\u0434\u043d\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e. \u0414\u043b\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f view<\/strong>, layout \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043c\u043e\u0436\u0435\u0442\u00a0\u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0430\u0434\u0430\u043f\u0442\u0435\u0440 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 view<\/strong> \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0438\u0437 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 view<\/strong> \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0443\u0442\u0435\u043c \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0445 view<\/strong> \u0438\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 findViewById()<\/a>.<\/p>\n RecyclerView<\/a> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u044d\u0442\u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 layout \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u044b:<\/p>\n \u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 layout \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440, \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0439\u0442\u0435\u0441\u044c \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 RecyclerView.LayoutManager<\/a>.<\/p>\n \u0410\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0432 RecyclerView<\/a>. \u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u044d\u0442\u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438, \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0439\u0442\u0435\u0441\u044c \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 RecyclerView.ItemAnimator<\/a> \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043c\u0435\u0442\u043e\u0434 RecyclerView.setItemAnimator()<\/a>.<\/p>\n \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c RecyclerView<\/a> \u0432 layout:<\/p>\n \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0432\u0438\u0434\u0436\u0435\u0442 RecyclerView<\/a> \u0432 layout, \u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u0435\u0433\u043e \u043a layout \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0443 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u0430\u0434\u0430\u043f\u0442\u0435\u0440 \u043a \u0434\u0430\u043d\u043d\u044b\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f:<\/p>\n \u0410\u0434\u0430\u043f\u0442\u0435\u0440 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0437\u0434\u0430\u0435\u0442 view<\/strong> \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 view<\/strong> \u043d\u043e\u0432\u044b\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0443\u0436\u0435 \u043d\u0435 \u0432\u0438\u0434\u0435\u043d. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u0442\u0440\u043e\u043a \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0438\u0434\u0436\u0435\u0442\u0430 TextView<\/a>:<\/p>\n CardView<\/a> \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 FrameLayout<\/a> \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0438. \u0412\u0438\u0434\u0436\u0435\u0442\u044b CardView<\/a> \u043c\u043e\u0433\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u0442\u0435\u043d\u0438 \u0438 \u0437\u0430\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u043d\u044b\u0435 \u0443\u0433\u043b\u044b.<\/p>\n \u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0443 \u0441 \u0442\u0435\u043d\u044c\u044e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 card_view:cardElevation<\/strong>. CardView<\/a> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u0432\u044b\u0441\u043e\u0442\u0443 \u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0442\u0435\u043d\u0438 \u043d\u0430 Android 5.0 (\u0443\u0440\u043e\u0432\u0435\u043d\u044c API 21) \u0438 \u0432\u044b\u0448\u0435, \u0430 \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u043c \u0442\u0435\u043d\u044f\u043c. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438<\/a>.<\/p>\n \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u044d\u0442\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u0438\u0434 \u0432\u0438\u0434\u0436\u0435\u0442\u0430 CardView<\/a>:<\/p>\n \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432\u0438\u0434\u0436\u0435\u0442 CardView<\/a> \u0432 \u043c\u0430\u043a\u0435\u0442:<\/p>\n \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0441\u043f\u0440\u0430\u0432\u043a\u0443 \u043f\u043e API \u0434\u043b\u044f CardView<\/a>.<\/p>\n \u0412\u0438\u0434\u0436\u0435\u0442\u044b RecyclerView<\/a> \u0438 CardView<\/a> \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a v7<\/a>. \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0432\u0438\u0434\u0436\u0435\u0442\u044b \u0432 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u044d\u0442\u0438 Gradle \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438<\/a> \u043a \u0432\u0430\u0448\u0435\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e:<\/p>\n <\/p>\n \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0443\u0440\u043e\u043a>>><\/a><\/p>\n <\/p>\n <\/p>\n","protected":false},"excerpt":{"rendered":" \u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430 developer.android.com <<<\u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0443\u0440\u043e\u043a \u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441 \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u0438 \u043a\u0430\u0440\u0442\u043e\u0447\u0435\u043a\u00a0\u0441 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c material design \u0432 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0438\u0434\u0436\u0435\u0442\u044b RecyclerView \u0438 CardView. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c \u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0442\u0430\u043a\u0436\u0435\u00a0\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f CardView \u0438 RecyclerView \u0432 Android \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0441\u043f\u0438\u0441\u043a\u0438 \u0412\u0438\u0434\u0436\u0435\u0442 RecyclerView — \u0431\u043e\u043b\u0435\u0435 \u0443\u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0438 \u0433\u0438\u0431\u043a\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f ListView. \u042d\u0442\u043e\u0442 \u0432\u0438\u0434\u0436\u0435\u0442 — \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 […]<\/p>\n","protected":false},"author":1,"featured_media":492,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"image","meta":[],"categories":[24,39,7],"tags":[3,14,25,15,4],"_links":{"self":[{"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/posts\/383"}],"collection":[{"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/comments?post=383"}],"version-history":[{"count":0,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/posts\/383\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/media\/492"}],"wp:attachment":[{"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/media?parent=383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/categories?post=383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/tags?post=383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441 \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u0438 \u043a\u0430\u0440\u0442\u043e\u0447\u0435\u043a\u00a0\u0441 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c material design \u0432 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0438\u0434\u0436\u0435\u0442\u044b RecyclerView<\/a> \u0438 CardView<\/a>.<\/h4>\n
\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0441\u043f\u0438\u0441\u043a\u0438<\/h3>\n
\n
<\/span><\/a>
<\/span><\/a>\n
\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u0438<\/h3>\n
\u041f\u0440\u0438\u043c\u0435\u0440\u044b<\/h3>\n
<!-- A RecyclerView with some commonly used attributes -->\r\n<android.support.v7.widget.RecyclerView\r\nandroid:id=\"@+id\/my_recycler_view\"\r\nandroid:scrollbars=\"vertical\"\r\nandroid:layout_width=\"match_parent\"\r\nandroid:layout_height=\"match_parent\"\/><\/pre>\n
public class MyActivity extends Activity {\r\nprivate RecyclerView mRecyclerView;\r\nprivate RecyclerView.Adapter mAdapter;\r\nprivate RecyclerView.LayoutManager mLayoutManager;\r\n\r\n@Override\r\nprotected void onCreate(Bundle savedInstanceState) {\r\nsuper.onCreate(savedInstanceState);\r\nsetContentView(R.layout.my_activity);\r\nmRecyclerView = (RecyclerView) findViewById(R.id.my_recycler_view);\r\n\r\n\/\/ use this setting to improve performance if you know that changes\r\n\/\/ in content do not change the layout size of the RecyclerView\r\nmRecyclerView.setHasFixedSize(true);\r\n\r\n\/\/ use a linear layout manager\r\nmLayoutManager = new LinearLayoutManager(this);\r\nmRecyclerView.setLayoutManager(mLayoutManager);\r\n\r\n\/\/ specify an adapter (see also next example)\r\nmAdapter = new MyAdapter(myDataset);\r\nmRecyclerView.setAdapter(mAdapter);\r\n}\r\n...\r\n}<\/pre>\npublic class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder> {\r\nprivate String[] mDataset;\r\n\r\n\/\/ Provide a reference to the views for each data item\r\n\/\/ Complex data items may need more than one view per item, and\r\n\/\/ you provide access to all the views for a data item in a view holder\r\npublic static class ViewHolder extends RecyclerView.ViewHolder {\r\n\/\/ each data item is just a string in this case\r\npublic TextView mTextView;\r\npublic ViewHolder(TextView v) {\r\nsuper(v);\r\nmTextView = v;\r\n}\r\n}\r\n\r\n\/\/ Provide a suitable constructor (depends on the kind of dataset)\r\npublic MyAdapter(String[] myDataset) {\r\nmDataset = myDataset;\r\n}\r\n\r\n\/\/ Create new views (invoked by the layout manager)\r\n@Override\r\npublic MyAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,\r\nint viewType) {\r\n\/\/ create a new view\r\nView v = LayoutInflater.from(parent.getContext())\r\n.inflate(R.layout.my_text_view, parent, false);\r\n\/\/ set the view's size, margins, paddings and layout parameters\r\n...\r\nViewHolder vh = new ViewHolder(v);\r\nreturn vh;\r\n}\r\n\r\n\/\/ Replace the contents of a view (invoked by the layout manager)\r\n@Override\r\npublic void onBindViewHolder(ViewHolder holder, int position) {\r\n\/\/ - get element from your dataset at this position\r\n\/\/ - replace the contents of the view with that element\r\nholder.mTextView.setText(mDataset[position]);\r\n\r\n}\r\n\r\n\/\/ Return the size of your dataset (invoked by the layout manager)\r\n@Override\r\npublic int getItemCount() {\r\nreturn mDataset.length;\r\n}\r\n}<\/pre>\n\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0438<\/h3>\n
<\/span><\/a>\n
<LinearLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\nxmlns:tools=\"http:\/\/schemas.android.com\/tools\"\r\nxmlns:card_view=\"http:\/\/schemas.android.com\/apk\/res-auto\"\r\n... >\r\n<!-- A CardView that contains a TextView -->\r\n<android.support.v7.widget.CardView\r\nxmlns:card_view=\"http:\/\/schemas.android.com\/apk\/res-auto\"\r\nandroid:id=\"@+id\/card_view\"\r\nandroid:layout_gravity=\"center\"\r\nandroid:layout_width=\"200dp\"\r\nandroid:layout_height=\"200dp\"\r\ncard_view:cardCornerRadius=\"4dp\">\r\n\r\n<TextView\r\nandroid:id=\"@+id\/info_text\"\r\nandroid:layout_width=\"match_parent\"\r\nandroid:layout_height=\"match_parent\" \/>\r\n<\/android.support.v7.widget.CardView>\r\n<\/LinearLayout><\/pre>\n
\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438<\/h3>\n
dependencies {\r\n...\r\ncompile 'com.android.support:cardview-v7:21.0.+'\r\ncompile 'com.android.support:recyclerview-v7:21.0.+'\r\n}<\/pre>\n\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c. \u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/a>.<\/h6>\n
Portions of this page are modifications based on work created and shared by the Android Open Source Project<\/a> and used according to terms described in the Creative Commons 2.5 Attribution License<\/a><\/h6>\n