title: RecyclerView scrolls when click on item Android
body: <p>I  have implemented RecyclerView with changing backround when clicked on an item. RecyclerView contains only TextView. Sometimes when I click on an item the recyclerview scroll little bit. Strange is, that recyclerview behave like this, sometimes is everything OK. I am not sure why the RV is acting like this.</p>
  <p><img src="https://i.imgur.com/Z9xX494m.gif" alt="" /></p>
  <p>Direct link to gif - <a href="https://imgur.com/Z9xX494" rel="nofollow noreferrer">Action on RecyclerView</a></p>
  <p>This is my Adapter</p>
  <pre><code>    private var selectedItemPosition: Int = 0
      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PolozkaViewHolder {
          val binding = PolozkyItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)
          return PolozkaViewHolder(binding)
      }
      override fun onBindViewHolder(holder: PolozkaViewHolder, position: Int) {
          val currentItem = getItem(position)
          holder.bind(currentItem)
        
          if (selectedItemPosition == position){
              holder.itemView.setBackgroundColor(Color.parseColor(&quot;#DA745A&quot;))
          } else
          {
              holder.itemView.setBackgroundColor(Color.TRANSPARENT)
          }
      }
      inner class PolozkaViewHolder(private val binding: PolozkyItemBinding): RecyclerView.ViewHolder(binding.root){
          init {
              binding.root.setOnClickListener{
                  val position = bindingAdapterPosition
                  if (position != RecyclerView.NO_POSITION){
                      val item = getItem(position)
                      if (item != null){
                          listener.onItemClick(item, position)
                          //listener.onItemClickListener(item, position)
                      }
                  }
                  notifyItemChanged(selectedItemPosition)
                  selectedItemPosition = absoluteAdapterPosition
                  notifyItemChanged(selectedItemPosition)
              }
              binding.root.setOnLongClickListener{
                  val positionLong = bindingAdapterPosition
                  if (positionLong != RecyclerView.NO_POSITION){
                      val itemLong = getItem(positionLong)
                      if(itemLong != null){
                          listener.onLongClick(itemLong)
                      }
                  }
                  true
              }            
          }
          fun bind(polozkaPolozka: Polozka){
              binding.apply {
                  tvStar.text =  if (polozkaPolozka.mnoz_vyd == 0.toFloat()){
                      &quot;&quot;
                  }else (if (polozkaPolozka.mnoz_vyd != polozkaPolozka.mnoz_obj){
                                  &quot;-&quot;
                              } else if (polozkaPolozka.mnoz_vyd == polozkaPolozka.mnoz_obj){
                                  &quot;*&quot;
                              } else{
                                  &quot;&quot;
                              })
                  tvKDE.text = polozkaPolozka.znacky
                  tvREG.text = polozkaPolozka.reg
                  tvVB.text = polozkaPolozka.veb.toString()
                  tvMN.text = polozkaPolozka.mnoz_obj.toString()
                  tvMNV.text = polozkaPolozka.mnoz_vyd.toString()
                  tvDATSPOTR.text = polozkaPolozka.datspo
                  tvSARZE.text = polozkaPolozka.sarze
  
              }
          }        
      }
      interface OnItemClickListener{
          fun onItemClick(polozkaDoklad: Polozka, position: Int)
          fun onLongClick(polozkaDoklad: Polozka) 
      }
      class DiffCallback: DiffUtil.ItemCallback&lt;Polozka&gt;(){
          override fun areItemsTheSame(oldItem: Polozka, newItem: Polozka) =
              oldItem.pvp06pk == newItem.pvp06pk
          override fun areContentsTheSame(oldItem: Polozka, newItem: Polozka) =
              oldItem == newItem
      }
  }
  </code></pre>
  <p>And this is my simple Activity</p>
  <pre><code>class PolozkaActivity: AppCompatActivity(), PolozkaAdapter.OnItemClickListener{
        override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val binding = ActivityPolozkaBinding.inflate(layoutInflater)
      }
  
      override fun onItemClick(polozkaDoklad: Polozka, position: Int) {
          val resultReg = polozkaViewModel.getInfoByREG(polozkaDoklad.reg.toString())
          textViewStatus.text = &quot;$resultReg&quot;
          positionItem = position
      }
  
      override fun onLongClick(polozkaDoklad: Polozka) {
          val intent = Intent(this, NewActivity::class.java)
          startActivity(intent)
      }
  }    
  
  </code></pre>
  <p>EDIT: Change of url of gif.</p>