I have been trying this for the past week. I am trying to place the canvas drawing I have done of a circle with buttons below. However, when doing this either the buttons appear on the screen or just the canvas as either cover the other up, so does anyone have code or know how I can resolve this issue?
Asked
Active
Viewed 646 times
0
-
Have you tried to change the alpha of the circle? And what layout are you using. Could you also show how it should look like? – Martin Rajniak Aug 19 '12 at 16:45
-
Hi there, I did not understand what you meant by alpha, im using the extend View. Its just a simple circle on which I just want 1 or 2 buttons under the screen – paul smith Aug 19 '12 at 16:47
-
You don't "place a canvas". A canvas is a surface onto which you draw. Please show the code you have. – Simon Aug 19 '12 at 17:32
-
Well if I understand it correctly, your circle should be transparent in order to see the buttons beneath it. So you have to set an alpha of the colour to transparent. Try to have a look at this threads: [how to make surfaceview transparent](http://stackoverflow.com/questions/5391089/how-to-make-surfaceview-transparent) and [Android transparent canvas](http://stackoverflow.com/questions/7293961/android-transparent-canvas-surfaceview) – Martin Rajniak Aug 19 '12 at 19:33
-
sorry guys my code is posted below. – paul smith Aug 19 '12 at 20:11
1 Answers
0
if you create a layout programmaticly and add a surfaceview to it(containing the canvas you are drawing on), and then a button, the button will appear over the surface view.

WIllJBD
- 6,144
- 3
- 34
- 44
-
Sorry people I have been trying to place code in which is taking a long time, how can i place code here? – paul smith Aug 19 '12 at 19:36
-
`public class sample extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(new Draw (this)); } private class Draw extends View { public Draw (Context context) { super(context); } @Override public void onDraw(Canvas canvas) { super.onDraw(canvas);` – paul smith Aug 19 '12 at 19:47
-
`Paint paint1 = new Paint(); paint1.setColor(Color.BLUE); paint1.setAntiAlias(true); Paint paint4 = new Paint(); paint4.setColor(Color.WHITE); paint4.setAntiAlias(true); canvas.drawCircle(CentreX, CentreY, 100, paint1); canvas.drawCircle(CentreX, CentreY, 50, paint4);` – paul smith Aug 19 '12 at 19:48
-
sorry guys had to give it in 2 chunks as their were too many characters – paul smith Aug 19 '12 at 19:48