title: Flicker at top of recycler view
body: <p>I can see a flicker within my recycler view right at the top. The flicker seems to resemble the top lines of my drawable shapes in the recycler view item.xml. I have made various adjustments to lines and other things to see if I could prevent the flicker but nothing appears to be working.</p>
  <p>Here is my code;</p>
  <p><strong>Activity</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;wrap_content&quot;
      tools:context=&quot;.ScoreHistory&quot;&gt;
  
      &lt;TextView
          android:id=&quot;@+id/textView_history_title&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;60dp&quot;
          android:layout_marginStart=&quot;16dp&quot;
          android:layout_marginTop=&quot;16dp&quot;
          android:layout_marginEnd=&quot;16dp&quot;
          android:gravity=&quot;center|center_horizontal|center_vertical&quot;
          android:padding=&quot;5dp&quot;
          android:text=&quot;@string/GameHistory_Title&quot;
          android:textAlignment=&quot;gravity&quot;
          android:textColor=&quot;@color/lime&quot;
          android:textStyle=&quot;bold&quot;
          app:autoSizeTextType=&quot;uniform&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;
  
      &lt;androidx.recyclerview.widget.RecyclerView
          android:id=&quot;@+id/RV_scorehistory&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toBottomOf=&quot;@+id/textView_history_title&quot; /&gt;
  
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  <p><strong>My item.xml</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;55dp&quot;
      android:layout_marginLeft=&quot;5dp&quot;
      android:layout_marginRight=&quot;5dp&quot;
      android:background=&quot;@drawable/rv_lines&quot;
      android:gravity=&quot;center_vertical&quot;&gt;
  
      &lt;TextView
          android:id=&quot;@+id/TV_RV_ID&quot;
          android:layout_width=&quot;0dp&quot;
          android:layout_height=&quot;match_parent&quot;
          android:layout_margin=&quot;0dp&quot;
          android:gravity=&quot;center&quot;
          android:textAlignment=&quot;center&quot;
          app:layout_constraintEnd_toStartOf=&quot;@+id/TV_RV_DIFFICULTY&quot;
          app:layout_constraintHorizontal_bias=&quot;0.5&quot;
          app:layout_constraintHorizontal_weight=&quot;1&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;
  
      &lt;TextView
          android:id=&quot;@+id/TV_RV_DIFFICULTY&quot;
          android:layout_width=&quot;0dp&quot;
          android:layout_height=&quot;match_parent&quot;
          android:layout_marginStart=&quot;2dp&quot;
          android:gravity=&quot;center&quot;
          android:textAlignment=&quot;center&quot;
          app:layout_constraintBaseline_toBaselineOf=&quot;@+id/TV_RV_ID&quot;
          app:layout_constraintEnd_toStartOf=&quot;@+id/TV_RV_SUMTYPE&quot;
          app:layout_constraintHorizontal_bias=&quot;0.5&quot;
          app:layout_constraintHorizontal_weight=&quot;4&quot;
          app:layout_constraintStart_toEndOf=&quot;@+id/TV_RV_ID&quot; /&gt;
  
      &lt;TextView
          android:id=&quot;@+id/TV_RV_SUMTYPE&quot;
          android:layout_width=&quot;0dp&quot;
          android:layout_height=&quot;match_parent&quot;
          android:layout_marginStart=&quot;2dp&quot;
          android:gravity=&quot;center&quot;
          android:textAlignment=&quot;center&quot;
          app:layout_constraintBaseline_toBaselineOf=&quot;@+id/TV_RV_DIFFICULTY&quot;
          app:layout_constraintEnd_toStartOf=&quot;@+id/TV_RV_OutOfText&quot;
          app:layout_constraintHorizontal_bias=&quot;0.5&quot;
          app:layout_constraintHorizontal_weight=&quot;3.5&quot;
          app:layout_constraintStart_toEndOf=&quot;@+id/TV_RV_DIFFICULTY&quot; /&gt;
  
      &lt;TextView
          android:id=&quot;@+id/TV_RV_OutOfText&quot;
          android:layout_width=&quot;0dp&quot;
          android:layout_height=&quot;match_parent&quot;
          android:layout_marginStart=&quot;2dp&quot;
          android:gravity=&quot;center&quot;
          android:text=&quot;@string/score_text&quot;
          app:layout_constraintBaseline_toBaselineOf=&quot;@+id/TV_RV_SUMTYPE&quot;
          app:layout_constraintEnd_toStartOf=&quot;@+id/TV_RV_SCORE&quot;
          app:layout_constraintHorizontal_bias=&quot;0.5&quot;
          app:layout_constraintHorizontal_weight=&quot;2&quot;
          app:layout_constraintStart_toEndOf=&quot;@+id/TV_RV_SUMTYPE&quot; /&gt;
  
      &lt;TextView
          android:id=&quot;@+id/TV_RV_SCORE&quot;
          android:layout_width=&quot;0dp&quot;
          android:layout_height=&quot;match_parent&quot;
          android:layout_marginStart=&quot;6dp&quot;
          android:gravity=&quot;center&quot;
          android:textAlignment=&quot;center&quot;
          android:textStyle=&quot;bold&quot;
          app:layout_constraintBaseline_toBaselineOf=&quot;@+id/TV_RV_OutOfText&quot;
          app:layout_constraintEnd_toStartOf=&quot;@+id/TV_RV_QCOUNT_TEXT&quot;
          app:layout_constraintHorizontal_bias=&quot;0.5&quot;
          app:layout_constraintHorizontal_weight=&quot;1.5&quot;
          app:layout_constraintStart_toEndOf=&quot;@+id/TV_RV_OutOfText&quot; /&gt;
  
      &lt;TextView
          android:id=&quot;@+id/TV_RV_QCOUNT_TEXT&quot;
          android:layout_width=&quot;0dp&quot;
          android:layout_height=&quot;match_parent&quot;
          android:layout_marginStart=&quot;2dp&quot;
          android:gravity=&quot;center&quot;
          android:text=&quot;@string/questions_text&quot;
          android:textAlignment=&quot;gravity&quot;
          android:textStyle=&quot;bold&quot;
          app:layout_constraintBaseline_toBaselineOf=&quot;@+id/TV_RV_SCORE&quot;
          app:layout_constraintEnd_toStartOf=&quot;@+id/TV_RV_QCOUNT&quot;
          app:layout_constraintHorizontal_bias=&quot;0.5&quot;
          app:layout_constraintHorizontal_weight=&quot;.75&quot;
          app:layout_constraintStart_toEndOf=&quot;@+id/TV_RV_SCORE&quot; /&gt;
  
      &lt;TextView
          android:id=&quot;@+id/TV_RV_QCOUNT&quot;
          android:layout_width=&quot;0dp&quot;
          android:layout_height=&quot;match_parent&quot;
          android:layout_marginStart=&quot;2dp&quot;
          android:background=&quot;@drawable/target_icon&quot;
          android:gravity=&quot;center&quot;
          android:textAlignment=&quot;center&quot;
          android:textStyle=&quot;bold&quot;
          app:layout_constraintBaseline_toBaselineOf=&quot;@+id/TV_RV_QCOUNT_TEXT&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintHorizontal_bias=&quot;0.5&quot;
          app:layout_constraintHorizontal_weight=&quot;1.5&quot;
          app:layout_constraintStart_toEndOf=&quot;@+id/TV_RV_QCOUNT_TEXT&quot; /&gt;
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  <p>I set background resources here in my adapter</p>
  <pre><code>class ScoreHistoryAdaptor : ListAdapter&lt;SavedScores, ScoreHistoryAdaptor.SavedScoreViewHolder&gt;(WordsComparator()) {
  
      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SavedScoreViewHolder {
          return SavedScoreViewHolder.create(parent)
      }
  
      override fun onBindViewHolder(holder: SavedScoreViewHolder, position: Int) {
          val current = getItem(position)
          holder.bind(current.id,current.difficulty,current.sumtype,current.questioncount,current.answeredcorrectly)
      }
  
      class SavedScoreViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
          private val IDItemView: TextView = itemView.findViewById(R.id.TV_RV_ID)
          private val DiffultyItemView: TextView = itemView.findViewById(R.id.TV_RV_DIFFICULTY)
          private val SumTypeItemView: TextView = itemView.findViewById(R.id.TV_RV_SUMTYPE)
          private val qCountItemView: TextView = itemView.findViewById(R.id.TV_RV_QCOUNT)
          private val ScoreItemView: TextView = itemView.findViewById(R.id.TV_RV_SCORE)
          private var DIFFCODE = &quot;&quot;
          private var SUMTYPECODE = &quot;&quot;
          val myContext = SumTypeItemView.context
          fun bind(ID: Int?,DIFFICULTY:String?,SUMTYPE:String?,QC:Int?,SCORE:Int?) {
              IDItemView.text = ID.toString()
              when (DIFFICULTY) {
                  myContext.resources.getString(R.string.diffLVL1) -&gt; {DIFFCODE = DIFFICULTY; DiffultyItemView.setBackgroundResource(R.drawable.diff_easy_icon)}
                  myContext.resources.getString(R.string.diffLVL2) -&gt; {DIFFCODE = DIFFICULTY ; DiffultyItemView.setBackgroundResource(R.drawable.diff_normal_icon)}
                  myContext.resources.getString(R.string.diffLVL3) -&gt; {DIFFCODE = DIFFICULTY; DiffultyItemView.setBackgroundResource(R.drawable.diff_hard_icon) }
                  myContext.resources.getString(R.string.diffLVL4) -&gt; {DIFFCODE = DIFFICULTY ; DiffultyItemView.setBackgroundResource(R.drawable.diff_impossible_icon)}
                  myContext.resources.getString(R.string.random) -&gt; {DIFFCODE = DIFFICULTY ; DiffultyItemView.setBackgroundResource(R.drawable.diff_random_icon)}
              }
  
              DiffultyItemView.text = DIFFCODE
              when (SUMTYPE) {
                  myContext.resources.getString(R.string.catMulti) -&gt; {SUMTYPECODE = myContext.resources.getString(R.string.multi_symbol) }
                  myContext.resources.getString(R.string.catAdd) -&gt; {SUMTYPECODE = myContext.resources.getString(R.string.add_symbol)}
                  myContext.resources.getString(R.string.catSub) -&gt; {SUMTYPECODE = myContext.resources.getString(R.string.sub_symbol)}
                  myContext.resources.getString(R.string.catDiv) -&gt; {SUMTYPECODE = myContext.resources.getString(R.string.div_symbol)}
                  myContext.resources.getString(R.string.catSqrR) -&gt; {SUMTYPECODE = myContext.resources.getString(R.string.sqr_symbol) + &quot;n&quot;}
                  myContext.resources.getString(R.string.catSqrD) -&gt; {SUMTYPECODE = &quot;n&quot; + myContext.resources.getString(R.string.sqrd_symbol)}
                  myContext.resources.getString(R.string.catCubeR) -&gt; {SUMTYPECODE = myContext.resources.getString(R.string.cuber_symbol) + &quot;n&quot;}
                  myContext.resources.getString(R.string.catCubeD) -&gt; {SUMTYPECODE = &quot;n&quot; + myContext.resources.getString(R.string.cubed_symbol)}
                  myContext.resources.getString(R.string.random) -&gt; {SUMTYPECODE = myContext.resources.getString(R.string.random)}
              }
              when (IsScoreLessThanTarget(SCORE!!.toInt(),QC!!.toInt())){
                  true -&gt;{ScoreItemView.setBackgroundResource(R.drawable.somewrong_icon)}
                  false -&gt;{ScoreItemView.setBackgroundResource(R.drawable.allcorrect_icon)}
              }
              SumTypeItemView.setBackgroundResource(R.drawable.sumtype_icon)
              SumTypeItemView.text = SUMTYPECODE
              qCountItemView.text = QC.toString()
              ScoreItemView.text = SCORE.toString()
          }
  
  
  
          companion object {
              fun create(parent: ViewGroup): SavedScoreViewHolder {
                  val view: View = LayoutInflater.from(parent.context)
                      .inflate(R.layout.row_item, parent, false)
                  return SavedScoreViewHolder(view)
              }
          }
      }
  
      class WordsComparator : DiffUtil.ItemCallback&lt;SavedScores&gt;() {
          override fun areItemsTheSame(oldItem: SavedScores, newItem: SavedScores): Boolean {
              return oldItem.id == newItem.id
          }
  
          override fun areContentsTheSame(oldItem: SavedScores, newItem: SavedScores): Boolean {
              return oldItem == newItem
          }
      }
  }
  private fun IsScoreLessThanTarget(score:Int,target:Int): Boolean{
      return score &lt; target
  }
  </code></pre>
  <p><img src="https://i.stack.imgur.com/wDXHh.png" alt="enter image description here" /></p>
  <p>In another view using scrollview I get the same</p>
  <p><img src="https://i.stack.imgur.com/nf33x.png" alt="enter image description here" /></p>