Adding button on top of Imageview at runtime
<p>I am creating a imageview at runtime and now want a add a button on top of the Imageview dynamically at run time and if I pan the image in the imageview the button in it should also pan accordingly. The problem is that Imageview does not allow to add subviews in it. </p>

<p>I am able to add the button on top of the imageview but when I pan the imageview the button remains constant in the screen. Any idea on how to do this? 
            Here is what I did:</p>

<pre><code>        panImageView = new PanView(this); //Custom Imageview class to handle panning
        panImageView.setScaleType(ImageView.ScaleType.CENTER);
        //panimg.setAdjustViewBounds(true);

        FrameLayout mainRL = (FrameLayout) findViewById(R.id.mainRelativeLayout);
        mainRL.addView(panImageView);

        ImageWorker imgTask = new ImageWorker(panImageView, is);
        imgTask.execute(2000, 2000);


        //Start button
        Button startButton = new Button(this);

        int iRndBtn = R.drawable.round_button;
        startButton.setBackgroundResource(iRndBtn);

        startButton.getBackground().setColorFilter(Color.GREEN,PorterDuff.Mode.MULTIPLY);

        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(50, 50);
        //layoutParams.setMargins(intialPage.mapStartX, intialPage.mapStartY, 0, 0);
        layoutParams.setMargins(200, 200, 0, 0);
        startButton.setLayoutParams(layoutParams);
        //startButton.
        mainRL.addView(startButton,layoutParams);
</code></pre>
