views:

185

answers:

0

Hello,

I am drawing up a grid on a canvas as below, I have not been able to get the scroll bar to appear, I looked around for examples, but none of them give details on drawing scroll bars for custom views.

Your help is much appreciated.

public class GridActivity extends Activity 
{

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    // i tried to do as in the documentation nothing seems to happen 

    LinearLayout lLayout = new LinearLayout(this);
    lLayout.addView(new GridView (this), new     ViewGroup.LayoutParams(800,600));

    FrameLayout fLayout = new FrameLayout(this);
    fLayout.addView(lLayout, new ViewGroup.LayoutParams(800,600));

    setContentView(fLayout);
}


private class GridView extends ScrollView
{

  private ShapeDrawable[] mDrawable;
  public GridView (Context context) {

     // some initialization

  }

  protected void onDraw(Canvas canvas) {
     for each i
       mDrawable[i].draw(canvas)
  }  
}

}