{"id":455056,"date":"2025-04-07T21:00:08","date_gmt":"2025-04-07T21:00:08","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=455056"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=455056","title":{"rendered":"<span>\u041f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435\u043b\u044c\u0437\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c RecyclerView \u0432 NestedScrollView \u0438 \u043a\u0430\u043a \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c?<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430\u00a0\u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u043a\u0430\u043a\u00a0\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 RecyclerView. \u0423\u00a0Recycler \u0435\u0441\u0442\u044c ViewHolder&#8217;\u044b, \u0447\u0430\u0441\u0442\u044c \u0438\u0437\u00a0\u043d\u0438\u0445 \u0432\u0438\u0434\u043d\u044b, \u0430\u00a0\u0434\u0440\u0443\u0433\u0438\u0435 \u0434\u0432\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435\u00a0\u0432\u0438\u0434\u0438\u0442. \u041e\u0434\u0438\u043d \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u0441\u0432\u0435\u0440\u0445\u0443, \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u043d\u0438\u0437\u0443. \u041f\u0440\u0438\u00a0\u043f\u0440\u043e\u043a\u0440\u0443\u0442\u043a\u0438 \u0441\u043f\u0438\u0441\u043a\u0430, \u0441\u0442\u0430\u0440\u044b\u0435 ViewHolder&#8217;\u044b \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0430\u00a0\u043d\u043e\u0432\u044b\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e\u00a0\u0432\u00a0\u0430\u0434\u0430\u043f\u0442\u0435\u0440\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 onBindViewHolder.<\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0440\u0430\u043d \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0446\u0438\u0444\u0440.<\/p>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt; &lt;androidx.constraintlayout.widget.ConstraintLayout      xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"     xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"     android:layout_width=\"match_parent\"     android:layout_height=\"match_parent\"&gt;      &lt;androidx.recyclerview.widget.RecyclerView         android:id=\"@+id\/recyclerView\"         android:layout_width=\"match_parent\"         android:layout_height=\"match_parent\"         app:layoutManager=\"androidx.recyclerview.widget.LinearLayoutManager\" \/&gt;  &lt;\/androidx.constraintlayout.widget.ConstraintLayout&gt;<\/code><\/pre>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt; &lt;FrameLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"     android:layout_width=\"match_parent\"     android:layout_height=\"wrap_content\"&gt;      &lt;TextView         android:id=\"@+id\/tvName\"         android:layout_width=\"match_parent\"         android:layout_height=\"wrap_content\"         android:padding=\"10dp\"         android:layout_gravity=\"center_horizontal\"\/&gt;      &lt;View         android:layout_width=\"match_parent\"         android:layout_height=\"1dp\"         android:background=\"@color\/gray\"\/&gt;  &lt;\/FrameLayout&gt;<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u0434\u0430\u043f\u0442\u0435\u0440.<\/p>\n<pre><code class=\"kotlin\">class CustomAdapter() : RecyclerView.Adapter&lt;CustomAdapter.CustomViewHolder&gt;() {     private var data: List&lt;Int&gt; = listOf()       inner class CustomViewHolder(private val binding: ItemRvBinding) :         RecyclerView.ViewHolder(binding.root) {         fun onBind(value: Int) {             binding.tvName.text = value.toString()         }     }      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CustomViewHolder {         return CustomViewHolder(             ItemRvBinding.inflate(                 LayoutInflater.from(parent.context),                 parent,                 false             )         )     }      override fun getItemCount(): Int {         return data.size     }      override fun onBindViewHolder(holder: CustomViewHolder, position: Int) {         holder.onBind(data[position])     }      fun setList(list: List&lt;Int&gt;) {         data = list         notifyDataSetChanged()     } }<\/code><\/pre>\n<p>setList \u043d\u0435\u043b\u044c\u0437\u044f \u0442\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043d\u0435\u00a0\u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043b\u044f\u00a0\u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u044f. \u0412\u00a0\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f DiffUtil.<\/p>\n<pre><code class=\"kotlin\">class MainActivity : AppCompatActivity() {     private lateinit var binding: ActivityMainBinding      override fun onCreate(savedInstanceState: Bundle?) {         super.onCreate(savedInstanceState)         binding = ActivityMainBinding.inflate(layoutInflater)         setContentView(binding.root)          val adapter = CustomAdapter()         binding.recyclerView.adapter = adapter          binding.recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {             override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {                 Log.d(                     \"COUNT_VISIBLE_ITEM\",                     binding.recyclerView.layoutManager?.childCount.toString()                 )                 super.onScrollStateChanged(recyclerView, newState)             }              override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {                 super.onScrolled(recyclerView, dx, dy)             }         })          val list = mutableListOf&lt;Int&gt;()         for (i in 1..1000) {             list.add(i)         }          adapter.setList(list)     } }<\/code><\/pre>\n<p>\u041d\u0430\u00a0recyclerView \u044f \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b addOnScrollListener, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0432\u044b\u0432\u043e\u0434\u0438\u043b \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e ViewHolder&#8217;\u043e\u0432 \u043f\u0440\u0438\u00a0\u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0440\u043e\u043a\u0440\u0443\u0442\u043a\u0435.<\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442, \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043b\u043e\u0433\u0438. \u0427\u0438\u0441\u043b\u043e ViewHolder&#8217;\u043e\u0432 \u0432\u0430\u0440\u044c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0442 22\u00a0\u0434\u043e 23.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043a\u00a0\u043d\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0434\u0438\u0437\u0430\u0439\u043d\u0435\u0440, \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u0447\u0442\u043e\u00a0\u0441\u0432\u0435\u0440\u0445\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u043f\u043b\u0430\u0448\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043a\u0440\u043e\u043b\u0438\u0442\u044c\u0441\u044f.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ae0\/702\/40c\/ae070240c8958c2dae86b73661ceaab8.png\" width=\"1440\" height=\"3120\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ae0\/702\/40c\/ae070240c8958c2dae86b73661ceaab8.png\"\/><\/figure>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt; &lt;androidx.constraintlayout.widget.ConstraintLayout      xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"     xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"     android:layout_width=\"match_parent\"     android:layout_height=\"match_parent\"&gt;      &lt;androidx.core.widget.NestedScrollView         android:layout_width=\"match_parent\"         android:layout_height=\"match_parent\"         android:orientation=\"vertical\"&gt;           &lt;LinearLayout             android:layout_width=\"match_parent\"             android:layout_height=\"match_parent\"             android:orientation=\"vertical\"&gt;              &lt;ImageView                 android:layout_width=\"200dp\"                 android:layout_height=\"200dp\"                 android:layout_gravity=\"center_horizontal\"                 android:layout_marginTop=\"8dp\"                 android:src=\"@drawable\/ic_github\" \/&gt;              &lt;TextView                 android:layout_width=\"match_parent\"                 android:layout_height=\"wrap_content\"                 android:layout_marginTop=\"8dp\"                 android:gravity=\"center_horizontal\"                 android:text=\"@string\/name\"                 android:textColor=\"@color\/black\"                 android:textSize=\"20sp\"                 android:textStyle=\"bold\" \/&gt;              &lt;androidx.recyclerview.widget.RecyclerView                 android:id=\"@+id\/recyclerView\"                 android:layout_width=\"match_parent\"                 android:layout_height=\"match_parent\"                 android:layout_marginTop=\"16dp\"                 app:layoutManager=\"androidx.recyclerview.widget.LinearLayoutManager\" \/&gt;           &lt;\/LinearLayout&gt;     &lt;\/androidx.core.widget.NestedScrollView&gt; &lt;\/androidx.constraintlayout.widget.ConstraintLayout&gt;<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0447\u0442\u043e\u2011\u0442\u043e \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0435. \u041d\u043e\u00a0\u0437\u0430\u0439\u0434\u044f \u0432\u00a0\u043b\u043e\u0433\u0438, \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0443\u0436\u0430\u0441\u0430\u044e\u0449\u0443\u044e \u043d\u0430\u0434\u043f\u0438\u0441\u044c.<br \/>COUNT_VISIBLE_ITEM habr_tests D 1000\u00a0<\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a\u00a0RecyclerView \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432\u00a0NestedScrollView, \u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u043e\u00a0\u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438 \u0440\u0430\u0441\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u00a0\u0432\u0435\u0441\u044c \u044d\u043a\u0440\u0430\u043d. \u0418\u0437\u2011\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u0432\u0441\u0435 ViewHolder&#8217;\u044b, \u0438 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0443 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u043e \u0432\u0441\u0435 \u044d\u0442\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c. \u041c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043b\u0430\u0433\u0438, \u0435\u0441\u043b\u0438\u00a0\u043b\u0438\u0441\u0442\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a. \u0422\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f. \u041d\u043e\u00a0\u043a\u0430\u043a\u00a0\u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c?<\/p>\n<p>\u0415\u0441\u0442\u044c \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430, \u043a\u0430\u043a\u00a0\u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. <\/p>\n<ul>\n<li>\n<p>CollapsingToolbarLayout<\/p>\n<\/li>\n<li>\n<p>ViewType<\/p>\n<\/li>\n<\/ul>\n<h2>CollapsingToolbarLayout<\/h2>\n<p>\u0418\u0437\u043c\u0435\u043d\u0438\u043c activity_main.xml.<\/p>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt; &lt;androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"     xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"     android:layout_width=\"match_parent\"     android:layout_height=\"match_parent\"&gt;      &lt;com.google.android.material.appbar.AppBarLayout         android:layout_width=\"match_parent\"         android:layout_height=\"wrap_content\"&gt;          &lt;com.google.android.material.appbar.CollapsingToolbarLayout             android:layout_width=\"match_parent\"             android:layout_height=\"match_parent\"             app:layout_scrollFlags=\"scroll|exitUntilCollapsed\"&gt;              &lt;LinearLayout                 android:layout_width=\"match_parent\"                 android:layout_height=\"match_parent\"                 android:orientation=\"vertical\"                 app:layout_collapseMode=\"pin\"&gt;                  &lt;ImageView                     android:layout_width=\"200dp\"                     android:layout_height=\"200dp\"                     android:layout_gravity=\"center_horizontal\"                     android:layout_marginTop=\"8dp\"                     android:src=\"@drawable\/ic_github\" \/&gt;                  &lt;TextView                     android:layout_width=\"match_parent\"                     android:layout_height=\"wrap_content\"                     android:layout_marginTop=\"8dp\"                     android:gravity=\"center_horizontal\"                     android:text=\"@string\/name\"                     android:textColor=\"@color\/black\"                     android:textSize=\"20sp\"                     android:textStyle=\"bold\" \/&gt;             &lt;\/LinearLayout&gt;         &lt;\/com.google.android.material.appbar.CollapsingToolbarLayout&gt;     &lt;\/com.google.android.material.appbar.AppBarLayout&gt;      &lt;androidx.recyclerview.widget.RecyclerView         android:id=\"@+id\/recyclerView\"         android:layout_width=\"match_parent\"         android:layout_height=\"match_parent\"         app:layout_behavior=\"@string\/appbar_scrolling_view_behavior\"         android:paddingTop=\"16dp\"         android:clipToPadding=\"false\"         app:layoutManager=\"androidx.recyclerview.widget.LinearLayoutManager\" \/&gt;   &lt;\/androidx.coordinatorlayout.widget.CoordinatorLayout&gt;<\/code><\/pre>\n<p>\u0412\u00a0RecyclerView \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c layout_behavior. \u042d\u0442\u043e \u043d\u0443\u0436\u043d\u043e,\u0447\u0442\u043e\u0431\u044b recyclerView\u00a0\u0431\u044b\u043b \u043f\u043e\u0434\u00a0AppBarLayout&#8217;\u043e\u043c. \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c layout_scrollFlags \u0438 layout_collapseMode. \u0414\u0430\u043b\u0435\u0435 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u00a0\u043b\u043e\u0433\u0438 \u0438 \u0440\u0430\u0434\u0443\u0435\u043c\u0441\u044f \u0436\u0438\u0437\u043d\u0438, \u0432\u0435\u0434\u044c \u0442\u0435\u043f\u0435\u0440\u044c \u0447\u0438\u0441\u043b\u043e ViewHolder&#8217;\u043e\u0432 \u0432\u0435\u0440\u043d\u0443\u043b\u0430\u0441\u044c \u043a 22\u201323.<\/p>\n<h2>ViewType<\/h2>\n<p>\u0418\u0434\u0435\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u00a0\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e ViewType \u0432 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u0435.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c item_tittle.xml.<\/p>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt; &lt;LinearLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"     android:layout_width=\"match_parent\"     android:orientation=\"vertical\"     android:layout_height=\"wrap_content\"&gt;      &lt;ImageView         android:layout_width=\"200dp\"         android:layout_height=\"200dp\"         android:layout_gravity=\"center_horizontal\"         android:layout_marginTop=\"8dp\"         android:src=\"@drawable\/ic_github\" \/&gt;      &lt;TextView         android:id=\"@+id\/tvTittle\"         android:layout_width=\"match_parent\"         android:layout_height=\"wrap_content\"         android:layout_marginTop=\"8dp\"         android:gravity=\"center_horizontal\"         android:text=\"@string\/name\"         android:textColor=\"@color\/black\"         android:textSize=\"20sp\"         android:textStyle=\"bold\" \/&gt;  &lt;\/LinearLayout&gt;<\/code><\/pre>\n<p>\u041f\u043e\u043c\u0435\u043d\u044f\u0435\u043c CustomAdapter.<\/p>\n<pre><code class=\"kotlin\">class CustomAdapter() : RecyclerView.Adapter&lt;CustomAdapter.CustomViewHolder&gt;() {     private var data: List&lt;Any&gt; = listOf()      abstract class CustomViewHolder(view: View): RecyclerView.ViewHolder(view){         open fun onBind(position: Int){}     }      inner class ValueCustomViewHolder(private val binding: ItemRvBinding): CustomViewHolder(binding.root) {         override fun onBind(position: Int) {             val value = data[position] as Int             binding.tvName.text = value.toString()         }     }      inner class TittleCustomViewHolder(private val binding: ItemTittleBinding): CustomViewHolder(binding.root){         override fun onBind(position: Int) {             val value = data[position] as String             binding.tvTittle.text = value         }     }      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CustomViewHolder {         return when(viewType){             TITTLE_VIEW_TYPE -&gt; TittleCustomViewHolder(ItemTittleBinding.inflate(LayoutInflater.from(parent.context), parent, false))             VALUE_VIEW_TYPE -&gt; ValueCustomViewHolder(ItemRvBinding.inflate(LayoutInflater.from(parent.context), parent, false))             else -&gt; throw IllegalArgumentException(\"Invalid viewType: $viewType\")         }     }      override fun getItemViewType(position: Int): Int {         return when(data[position]){             is Int -&gt; VALUE_VIEW_TYPE             is String -&gt; TITTLE_VIEW_TYPE             else -&gt; throw IllegalArgumentException(\"Invalid data: ${data[position]}\")         }     }      override fun getItemCount(): Int {         return data.size     }      override fun onBindViewHolder(holder: CustomViewHolder, position: Int) {         when(holder){             is ValueCustomViewHolder -&gt; {                 holder.onBind(position)             }             is TittleCustomViewHolder -&gt;{                 holder.onBind(position)             }         }     }      fun setList(list: List&lt;Any&gt;) {         data = list         notifyDataSetChanged()     }      companion object{         const val TITTLE_VIEW_TYPE = 0         const val VALUE_VIEW_TYPE = 1     } }<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 CustomViewHolder \u0438 \u0432\u00a0\u043d\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e onBind. \u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u0441\u044f \u043e\u0442\u00a0\u043d\u0435\u0433\u043e \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c ViewHolder \u043f\u043e\u0434\u00a0\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0438 \u0447\u0438\u0441\u043b\u0430. \u0412\u00a0MainActivity \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u043f\u0435\u0440\u0435\u0434 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 list. <\/p>\n<pre><code class=\"kotlin\">list.add(getString(R.string.name))<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c, \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043b\u043e\u0433\u0438 \u0447\u0438\u0441\u043b\u043e ViewHolder&#8217;\u043e\u0432 \u0432\u0435\u0440\u043d\u0443\u043b\u0430\u0441\u044c \u043a 22\u201323.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043b ,\u0447\u0442\u043e\u00a0\u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437\u00a0NestedScrollView \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441\u00a0RecyclerView. \u0414\u043b\u044f\u00a0\u044d\u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 CollapsingToolBar \u0438\u043b\u0438\u00a0ViewType. \u0418\u0445 \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u00a0\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442\u00a0\u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u0432\u00a0\u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0438 \u044f\u00a0\u0431\u044b \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b CollapsingToolBar. <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/897894\/\"> https:\/\/habr.com\/ru\/articles\/897894\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430\u00a0\u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u043a\u0430\u043a\u00a0\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 RecyclerView. \u0423\u00a0Recycler \u0435\u0441\u0442\u044c ViewHolder&#8217;\u044b, \u0447\u0430\u0441\u0442\u044c \u0438\u0437\u00a0\u043d\u0438\u0445 \u0432\u0438\u0434\u043d\u044b, \u0430\u00a0\u0434\u0440\u0443\u0433\u0438\u0435 \u0434\u0432\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435\u00a0\u0432\u0438\u0434\u0438\u0442. \u041e\u0434\u0438\u043d \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u0441\u0432\u0435\u0440\u0445\u0443, \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u043d\u0438\u0437\u0443. \u041f\u0440\u0438\u00a0\u043f\u0440\u043e\u043a\u0440\u0443\u0442\u043a\u0438 \u0441\u043f\u0438\u0441\u043a\u0430, \u0441\u0442\u0430\u0440\u044b\u0435 ViewHolder&#8217;\u044b \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0430\u00a0\u043d\u043e\u0432\u044b\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e\u00a0\u0432\u00a0\u0430\u0434\u0430\u043f\u0442\u0435\u0440\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 onBindViewHolder.<\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0440\u0430\u043d \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0446\u0438\u0444\u0440.<\/p>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt; &lt;androidx.constraintlayout.widget.ConstraintLayout      xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"     xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"     android:layout_width=\"match_parent\"     android:layout_height=\"match_parent\"&gt;      &lt;androidx.recyclerview.widget.RecyclerView         android:id=\"@+id\/recyclerView\"         android:layout_width=\"match_parent\"         android:layout_height=\"match_parent\"         app:layoutManager=\"androidx.recyclerview.widget.LinearLayoutManager\" \/&gt;  &lt;\/androidx.constraintlayout.widget.ConstraintLayout&gt;<\/code><\/pre>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt; &lt;FrameLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"     android:layout_width=\"match_parent\"     android:layout_height=\"wrap_content\"&gt;      &lt;TextView         android:id=\"@+id\/tvName\"         android:layout_width=\"match_parent\"         android:layout_height=\"wrap_content\"         android:padding=\"10dp\"         android:layout_gravity=\"center_horizontal\"\/&gt;      &lt;View         android:layout_width=\"match_parent\"         android:layout_height=\"1dp\"         android:background=\"@color\/gray\"\/&gt;  &lt;\/FrameLayout&gt;<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u0434\u0430\u043f\u0442\u0435\u0440.<\/p>\n<pre><code class=\"kotlin\">class CustomAdapter() : RecyclerView.Adapter&lt;CustomAdapter.CustomViewHolder&gt;() {     private var data: List&lt;Int&gt; = listOf()       inner class CustomViewHolder(private val binding: ItemRvBinding) :         RecyclerView.ViewHolder(binding.root) {         fun onBind(value: Int) {             binding.tvName.text = value.toString()         }     }      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CustomViewHolder {         return CustomViewHolder(             ItemRvBinding.inflate(                 LayoutInflater.from(parent.context),                 parent,                 false             )         )     }      override fun getItemCount(): Int {         return data.size     }      override fun onBindViewHolder(holder: CustomViewHolder, position: Int) {         holder.onBind(data[position])     }      fun setList(list: List&lt;Int&gt;) {         data = list         notifyDataSetChanged()     } }<\/code><\/pre>\n<p>setList \u043d\u0435\u043b\u044c\u0437\u044f \u0442\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043d\u0435\u00a0\u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043b\u044f\u00a0\u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u044f. \u0412\u00a0\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f DiffUtil.<\/p>\n<pre><code class=\"kotlin\">class MainActivity : AppCompatActivity() {     private lateinit var binding: ActivityMainBinding      override fun onCreate(savedInstanceState: Bundle?) {         super.onCreate(savedInstanceState)         binding = ActivityMainBinding.inflate(layoutInflater)         setContentView(binding.root)          val adapter = CustomAdapter()         binding.recyclerView.adapter = adapter          binding.recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {             override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {                 Log.d(                     \"COUNT_VISIBLE_ITEM\",                     binding.recyclerView.layoutManager?.childCount.toString()                 )                 super.onScrollStateChanged(recyclerView, newState)             }              override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {                 super.onScrolled(recyclerView, dx, dy)             }         })          val list = mutableListOf&lt;Int&gt;()         for (i in 1..1000) {             list.add(i)         }          adapter.setList(list)     } }<\/code><\/pre>\n<p>\u041d\u0430\u00a0recyclerView \u044f \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b addOnScrollListener, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0432\u044b\u0432\u043e\u0434\u0438\u043b \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e ViewHolder&#8217;\u043e\u0432 \u043f\u0440\u0438\u00a0\u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0440\u043e\u043a\u0440\u0443\u0442\u043a\u0435.<\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442, \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043b\u043e\u0433\u0438. \u0427\u0438\u0441\u043b\u043e ViewHolder&#8217;\u043e\u0432 \u0432\u0430\u0440\u044c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0442 22\u00a0\u0434\u043e 23.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043a\u00a0\u043d\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0434\u0438\u0437\u0430\u0439\u043d\u0435\u0440, \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u0447\u0442\u043e\u00a0\u0441\u0432\u0435\u0440\u0445\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u043f\u043b\u0430\u0448\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043a\u0440\u043e\u043b\u0438\u0442\u044c\u0441\u044f.<\/p>\n<figure class=\"full-width\"><\/figure>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt; &lt;androidx.constraintlayout.widget.ConstraintLayout      xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"     xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"     android:layout_width=\"match_parent\"     android:layout_height=\"match_parent\"&gt;      &lt;androidx.core.widget.NestedScrollView         android:layout_width=\"match_parent\"         android:layout_height=\"match_parent\"         android:orientation=\"vertical\"&gt;           &lt;LinearLayout             android:layout_width=\"match_parent\"             android:layout_height=\"match_parent\"             android:orientation=\"vertical\"&gt;              &lt;ImageView                 android:layout_width=\"200dp\"                 android:layout_height=\"200dp\"                 android:layout_gravity=\"center_horizontal\"                 android:layout_marginTop=\"8dp\"                 android:src=\"@drawable\/ic_github\" \/&gt;              &lt;TextView                 android:layout_width=\"match_parent\"                 android:layout_height=\"wrap_content\"                 android:layout_marginTop=\"8dp\"                 android:gravity=\"center_horizontal\"                 android:text=\"@string\/name\"                 android:textColor=\"@color\/black\"                 android:textSize=\"20sp\"                 android:textStyle=\"bold\" \/&gt;              &lt;androidx.recyclerview.widget.RecyclerView                 android:id=\"@+id\/recyclerView\"                 android:layout_width=\"match_parent\"                 android:layout_height=\"match_parent\"                 android:layout_marginTop=\"16dp\"                 app:layoutManager=\"androidx.recyclerview.widget.LinearLayoutManager\" \/&gt;           &lt;\/LinearLayout&gt;     &lt;\/androidx.core.widget.NestedScrollView&gt; &lt;\/androidx.constraintlayout.widget.ConstraintLayout&gt;<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0447\u0442\u043e\u2011\u0442\u043e \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0435. \u041d\u043e\u00a0\u0437\u0430\u0439\u0434\u044f \u0432\u00a0\u043b\u043e\u0433\u0438, \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0443\u0436\u0430\u0441\u0430\u044e\u0449\u0443\u044e \u043d\u0430\u0434\u043f\u0438\u0441\u044c.<br \/>COUNT_VISIBLE_ITEM habr_tests D 1000\u00a0<\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a\u00a0RecyclerView \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432\u00a0NestedScrollView, \u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u043e\u00a0\u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438 \u0440\u0430\u0441\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u00a0\u0432\u0435\u0441\u044c \u044d\u043a\u0440\u0430\u043d. \u0418\u0437\u2011\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u0432\u0441\u0435 ViewHolder&#8217;\u044b, \u0438 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0443 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u043e \u0432\u0441\u0435 \u044d\u0442\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c. \u041c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043b\u0430\u0433\u0438, \u0435\u0441\u043b\u0438\u00a0\u043b\u0438\u0441\u0442\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a. \u0422\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f. \u041d\u043e\u00a0\u043a\u0430\u043a\u00a0\u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c?<\/p>\n<p>\u0415\u0441\u0442\u044c \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430, \u043a\u0430\u043a\u00a0\u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. <\/p>\n<ul>\n<li>\n<p>CollapsingToolbarLayout<\/p>\n<\/li>\n<li>\n<p>ViewType<\/p>\n<\/li>\n<\/ul>\n<h2>CollapsingToolbarLayout<\/h2>\n<p>\u0418\u0437\u043c\u0435\u043d\u0438\u043c activity_main.xml.<\/p>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt; &lt;androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"     xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"     android:layout_width=\"match_parent\"     android:layout_height=\"match_parent\"&gt;      &lt;com.google.android.material.appbar.AppBarLayout         android:layout_width=\"match_parent\"         android:layout_height=\"wrap_content\"&gt;          &lt;com.google.android.material.appbar.CollapsingToolbarLayout             android:layout_width=\"match_parent\"             android:layout_height=\"match_parent\"             app:layout_scrollFlags=\"scroll|exitUntilCollapsed\"&gt;              &lt;LinearLayout                 android:layout_width=\"match_parent\"                 android:layout_height=\"match_parent\"                 android:orientation=\"vertical\"                 app:layout_collapseMode=\"pin\"&gt;                  &lt;ImageView                     android:layout_width=\"200dp\"                     android:layout_height=\"200dp\"                     android:layout_gravity=\"center_horizontal\"                     android:layout_marginTop=\"8dp\"                     android:src=\"@drawable\/ic_github\" \/&gt;                  &lt;TextView                     android:layout_width=\"match_parent\"                     android:layout_height=\"wrap_content\"                     android:layout_marginTop=\"8dp\"                     android:gravity=\"center_horizontal\"                     android:text=\"@string\/name\"                     android:textColor=\"@color\/black\"                     android:textSize=\"20sp\"                     android:textStyle=\"bold\" \/&gt;             &lt;\/LinearLayout&gt;         &lt;\/com.google.android.material.appbar.CollapsingToolbarLayout&gt;     &lt;\/com.google.android.material.appbar.AppBarLayout&gt;      &lt;androidx.recyclerview.widget.RecyclerView         android:id=\"@+id\/recyclerView\"         android:layout_width=\"match_parent\"         android:layout_height=\"match_parent\"         app:layout_behavior=\"@string\/appbar_scrolling_view_behavior\"         android:paddingTop=\"16dp\"         android:clipToPadding=\"false\"         app:layoutManager=\"androidx.recyclerview.widget.LinearLayoutManager\" \/&gt;   &lt;\/androidx.coordinatorlayout.widget.CoordinatorLayout&gt;<\/code><\/pre>\n<p>\u0412\u00a0RecyclerView \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c layout_behavior. \u042d\u0442\u043e \u043d\u0443\u0436\u043d\u043e,\u0447\u0442\u043e\u0431\u044b recyclerView\u00a0\u0431\u044b\u043b \u043f\u043e\u0434\u00a0AppBarLayout&#8217;\u043e\u043c. \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c layout_scrollFlags \u0438 layout_collapseMode. \u0414\u0430\u043b\u0435\u0435 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u00a0\u043b\u043e\u0433\u0438 \u0438 \u0440\u0430\u0434\u0443\u0435\u043c\u0441\u044f \u0436\u0438\u0437\u043d\u0438, \u0432\u0435\u0434\u044c \u0442\u0435\u043f\u0435\u0440\u044c \u0447\u0438\u0441\u043b\u043e ViewHolder&#8217;\u043e\u0432 \u0432\u0435\u0440\u043d\u0443\u043b\u0430\u0441\u044c \u043a 22\u201323.<\/p>\n<h2>ViewType<\/h2>\n<p>\u0418\u0434\u0435\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u00a0\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e ViewType \u0432 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u0435.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c item_tittle.xml.<\/p>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt; &lt;LinearLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"     android:layout_width=\"match_parent\"     android:orientation=\"vertical\"     android:layout_height=\"wrap_content\"&gt;      &lt;ImageView         android:layout_width=\"200dp\"         android:layout_height=\"200dp\"         android:layout_gravity=\"center_horizontal\"         android:layout_marginTop=\"8dp\"         android:src=\"@drawable\/ic_github\" \/&gt;      &lt;TextView         android:id=\"@+id\/tvTittle\"         android:layout_width=\"match_parent\"         android:layout_height=\"wrap_content\"         android:layout_marginTop=\"8dp\"         android:gravity=\"center_horizontal\"         android:text=\"@string\/name\"         android:textColor=\"@color\/black\"         android:textSize=\"20sp\"         android:textStyle=\"bold\" \/&gt;  &lt;\/LinearLayout&gt;<\/code><\/pre>\n<p>\u041f\u043e\u043c\u0435\u043d\u044f\u0435\u043c CustomAdapter.<\/p>\n<pre><code class=\"kotlin\">class CustomAdapter() : RecyclerView.Adapter&lt;CustomAdapter.CustomViewHolder&gt;() {     private var data: List&lt;Any&gt; = listOf()      abstract class CustomViewHolder(view: View): RecyclerView.ViewHolder(view){         open fun<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-455056","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/455056","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=455056"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/455056\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=455056"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=455056"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=455056"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}