I have a RecyclerView with each row being a LinearLayout with a number of TextViews inside. Everything works fine on newer android versions, but when there is scrolling needed and the application is running on Android 4.4 some of the textViews are empty eventhough their value is assigned and onBindViewHolder is called.

I've tried invalidating the TextView and checked if other properties of textview work and they do, the only problem is with the text. This is how it looks:

My LinearLayout component:

init {
        isFocusable = true
        isClickable = true
        isFocusableInTouchMode = true
        background = ContextCompat.getDrawable(context, R.drawable.row_background)
        textViews.forEach {
            addView(it)
            it.maxLines = 1
            it.gravity = Gravity.CENTER
        }
}

This is how it looks right now on Kit Kat:

how_it_is
And this is how it should be:

how_it_should_be

0 Answers