protected final int getViewHeight ( @ NonNull final ListAdapter adapter , final int position ) { View view = adapter . getView ( position , null , this ) ; LayoutParams layoutParams = ( LayoutParams ) view . getLayoutParams ( ) ; if ( layoutParams == null ) { layoutParams = new LayoutParams ( LayoutParams . MATCH_PARENT , LayoutParams . WRAP_CONTENT ) ; view . setLayoutParams ( layoutParams ) ; } int widthMeasureSpec = getChildMeasureSpec ( MeasureSpec . makeMeasureSpec ( getColumnWidthCompatible ( ) , MeasureSpec . EXACTLY ) , 0 , layoutParams . width ) ; int heightMeasureSpec = getChildMeasureSpec ( MeasureSpec . makeMeasureSpec ( 0 , MeasureSpec . UNSPECIFIED ) , 0 , layoutParams . height ) ; view . measure ( widthMeasureSpec , heightMeasureSpec ) ; return view . getMeasuredHeight ( ) ; }
Returns the height of the view which corresponds to a specific position of an adapter .