@Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); int totalHeight = 0; int childCount = getChildCount(); for(int i = 0; i < childCount; i++) totalHeight += getChildAt(i).getMeasuredHeight(); showDivider(totalHeight > getMeasuredHeight() || (totalHeight == getMeasuredHeight() && getAdapter().getCount() > childCount)); }