Creating a grid view in a bookshelf in android

I found this useful presentation and this code from it:

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); } } 

but there are some things that are not clear, such as:

  • How to draw the edges. I need a little explanation, if possible, and if you offer some topics to explore, to understand this, everything will be fine.
  • What are the variables, height and width (are they for a gridview?)

and thanks in advance

+4
source share

All Articles