I added a button and a point in my project and put the point and button in the relative layout and set them same params like this code:
rllp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
rllp.topMargin = 0 ;
rllp.leftMargin = 0 ;
rllp2 = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
rllp2.topMargin = 0 ;
rllp2.leftMargin = 0 ;
drawingImageView = (ImageView) this.findViewById(R.id.DrawingImageView);
Bitmap bitmap = Bitmap.createBitmap((int) getWindowManager()
.getDefaultDisplay().getWidth(), (int) getWindowManager()
.getDefaultDisplay().getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
drawingImageView.setImageBitmap(bitmap);
Paint paint = new Paint();
paint.setStrokeWidth(6);
drawingImageView.setLayoutParams(rllp);
canvas.drawPoint(0, 0, paint);
btn = (Button) findViewById(R.id.button1);
btn.setLayoutParams(rllp2);
but result is not what I wanted!! the button and the point is not in the same position ... and I was going to put both of them in the (0,0). I think problem is here:
Bitmap bitmap = Bitmap.createBitmap((int) getWindowManager()
.getDefaultDisplay().getWidth(), (int) getWindowManager()
.getDefaultDisplay().getHeight(), Bitmap.Config.ARGB_8888);
but I don't have any solution for this ... how can I set their position in one place?? it's the picture of result : https://i.stack.imgur.com/IWx7V.png I want to put the point at the top-left corner of the button.