prepareView(parentView: View, adapterPosition: Int) { // Create view val view = listView.adapter.getView(adapterPosition, null, null) // Measure and layout view val specWidth = View.MeasureSpec.makeMeasureSpec(parentView.width, View.MeasureSpec.EXACTLY) val specHeight = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED) view.measure(specWidth, specHeight) view.layout(0, 0, view.measuredWidth, view.measuredHeight) }