car/src/main/java/androidx/car/widget/PagedListView.java
private void drawDivider(Canvas c, View container, int spacing) {
            View startChild =
                    mDividerStartId != INVALID_RESOURCE_ID
                            ? container.findViewById(mDividerStartId)
                            : container;

            View endChild =
                    mDividerEndId != INVALID_RESOURCE_ID
                            ? container.findViewById(mDividerEndId)
                            : container;

            if (startChild == null || endChild == null) {
                return;
            }

            Rect containerRect = new Rect();
            container.getGlobalVisibleRect(containerRect);

            Rect startRect = new Rect();
            startChild.getGlobalVisibleRect(startRect);

            Rect endRect = new Rect();
            endChild.getGlobalVisibleRect(endRect);

            int left = container.getLeft() + mDividerStartMargin
                    + (startRect.left - containerRect.left);
            int right = container.getRight()  - mDividerEndMargin
                    - (endRect.right - containerRect.right);
            // "(spacing + divider height) / 2" aligns the center of divider to that of spacing
            // between two items.
            // When spacing is an odd value (e.g. created by other decoration), space under divider
            // is greater by 1dp.
            int bottom = container.getBottom() + (spacing + mDividerHeight) / 2;
            int top = bottom - mDividerHeight;

            c.drawRect(left, top, right, bottom, mPaint);
        }
/**
         * Draws a divider under {@code container}.
         *
         * @param spacing between {@code container} and next view.
         */
Draws a divider under  container.
@param spacing between  container and next view.
Draws a divider under container . @param spacing between container and next view .
private void drawDivider(Canvas c, View container, int spacing) {
            View startChild =
                    mDividerStartId != INVALID_RESOURCE_ID
                            ? container.findViewById(mDividerStartId)
                            : container;
            View endChild =
                    mDividerEndId != INVALID_RESOURCE_ID
                            ? container.findViewById(mDividerEndId)
                            : container;
            if (startChild == null || endChild == null) {
                return;
            }
            Rect containerRect = new Rect();
            container.getGlobalVisibleRect(containerRect);
            Rect startRect = new Rect();
            startChild.getGlobalVisibleRect(startRect);
            Rect endRect = new Rect();
            endChild.getGlobalVisibleRect(endRect);
            int left = container.getLeft() + mDividerStartMargin
                    + (startRect.left - containerRect.left);
            int right = container.getRight()  - mDividerEndMargin
                    - (endRect.right - containerRect.right);
            int bottom = container.getBottom() + (spacing + mDividerHeight) / 2;
            int top = bottom - mDividerHeight;
            c.drawRect(left, top, right, bottom, mPaint);
        }
private void drawDivider ( Canvas c , View container , int spacing ) { View startChild = mDividerStartId != INVALID_RESOURCE_ID ? container . findViewById ( mDividerStartId ) : container ; View endChild = mDividerEndId != INVALID_RESOURCE_ID ? container . findViewById ( mDividerEndId ) : container ; if ( startChild == null || endChild == null ) { return ; } Rect containerRect = new Rect ( ) ; container . getGlobalVisibleRect ( containerRect ) ; Rect startRect = new Rect ( ) ; startChild . getGlobalVisibleRect ( startRect ) ; Rect endRect = new Rect ( ) ; endChild . getGlobalVisibleRect ( endRect ) ; int left = container . getLeft ( ) + mDividerStartMargin + ( startRect . left - containerRect . left ) ; int right = container . getRight ( ) - mDividerEndMargin - ( endRect . right - containerRect . right ) ; int bottom = container . getBottom ( ) + ( spacing + mDividerHeight ) / 2 ; int top = bottom - mDividerHeight ; c . drawRect ( left , top , right , bottom , mPaint ) ; }
Draws a divider under {@code container}.
Draws a divider under { @code container } .
// "(spacing + divider height) / 2" aligns the center of divider to that of spacing // between two items. // When spacing is an odd value (e.g. created by other decoration), space under divider // is greater by 1dp.