如何实现行跟行之间又一个分割线呢 需要自定义实现:
public class LineGridView extends GridView { public LineGridView(Context context) { super(context); // TODO Auto-generated constructor stub } public LineGridView(Context context, AttributeSet attrs) { super(context, attrs); } public LineGridView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); int childCount = getChildCount(); Paint localPaint; localPaint = new Paint(); localPaint.setStrokeWidth((float) 10.0); localPaint.setColor(getContext().getResources().getColor(R.color.RGB_FFFFFF));//间隔线颜色 Bitmap mBackgroundBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.bg);//间隔线背景 for (int i = 0; i < childCount; i++) { View cellView = getChildAt(i);
//间隔线是线的时候 canvas.drawLine(20, cellView.getBottom(), getWidth() - 20, cellView.getBottom(), localPaint);
//间隔线是图片的时候 canvas.drawBitmap(mBackgroundBitmap, -10, cellView.getBottom(), localPaint); } } }