コード例 #1
0
 @Override
 protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
   mList.layout(0, 0, mList.getMeasuredWidth(), getHeight());
   if (mHeader != null) {
     MarginLayoutParams lp = (MarginLayoutParams) mHeader.getLayoutParams();
     int headerTop = lp.topMargin;
     mHeader.layout(
         mPaddingLeft,
         headerTop,
         mHeader.getMeasuredWidth() + mPaddingLeft,
         headerTop + mHeader.getMeasuredHeight());
   }
 }
コード例 #2
0
 @Override
 protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
   mList.layout(0, 0, mList.getMeasuredWidth(), getHeight());
   if (mHeader != null) {
     MarginLayoutParams lp = (MarginLayoutParams) mHeader.getLayoutParams();
     int headerTop = lp.topMargin + (mClippingToPadding ? mPaddingTop : 0);
     // The left parameter must for some reason be set to 0.
     // I think it should be set to mPaddingLeft but apparently not
     mHeader.layout(
         mPaddingLeft,
         headerTop,
         mHeader.getMeasuredWidth() + mPaddingLeft,
         headerTop + mHeader.getMeasuredHeight());
   }
 }