4

我发现了这个有用的演示文稿 ,这段代码来自它:

public class BookshelfGridView extends GridView {
  // Constructors etc

  protected void dispatchDraw(Canvas canvas) {
    for (int y = top; y < height; y += mWoodPanelHeight) {
      for (int x = mLeftWidth; x < width; x += mWoodPanelWidth) {
        canvas.drawBitmap(mWoodPanelImage, x, y, null);
      }
    }

    for (int y = top; y < height; y += mShelfHeight) {
      // Draw left edge
      // Draw shelf
      // Draw right edge
    }

    super.dispatchDraw(canvas);
  }
}

但是有些事情不清楚,例如:

  • 如何绘制边缘。如果可能的话,我需要一些解释,如果你建议一些要研究的主题来理解它,那很好。
  • 什么是变量,高度和宽度(它们用于 GridView 吗?)

并提前感谢

4

0 回答 0