Adding Buttons on top of a ImageView in a RelativeLayout
<p>I'm designing a board game that consists of a bunch of buttons on top of a static board. I have set the background image (the board) as an ImageView inside of a ScrollView to handle scrolling of the board since it is too big to view on the screen. I then create a RelativeLayout and add the various buttons to it. This allows me to position the buttons around the board as I please but then when I scroll around, the buttons stay on-screen, which results in them moving out of position. Is there a way to leave the buttons in a static position while allowing me to scroll around the board?</p>

<p>Here is some of my code:</p>

<pre><code>    super.onCreate(savedInstanceState);

    RelativeLayout outerLayout = new RelativeLayout(this); 
    outerLayout.setLayoutParams(new LayoutParams(1200,1200));

    RelativeLayout buttonLayout = new RelativeLayout(this);
    buttonLayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));

    final ImageView i = new ImageView(this);
    i.setImageResource(R.drawable.board);
    i.setScaleType(ImageView.ScaleType.CENTER);
    i.setAdjustViewBounds(true);
    i.setLayoutParams(new LayoutParams(1200,1500));

    final Button b1 = new Button(this);
    b1.setText("1");
    b1.setTextSize(8);
    buttonLayout.addView(b1);
    b1.setId(1);
    RelativeLayout.LayoutParams rp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    rp.addRule(RelativeLayout.CENTER_IN_PARENT,-1);
    b1.setLayoutParams(rp);

    Button b2 = new Button(this);
    b2.setText("2");
    b2.setTextSize(8);
    buttonLayout.addView(b2);
    b2.setId(2);
    RelativeLayout.LayoutParams r2 = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    r2.addRule(RelativeLayout.RIGHT_OF, 1);
    b2.setLayoutParams(r2);

    ScrollView sv = new ScrollView(this);
    sv.addView(i);
    outerLayout.addView(sv);
    outerLayout.addView(buttonLayout);
</code></pre>

<p>Also if you could provide the answer programmatically that would be great, my professor doesn't want us to use XML.</p>
