Currently, My goal is to place some images in an arrangement relative to the center of the screen. There is a varying number of images and locations, so I'd like to do this programmatically.
I am having trouble finding the center of the correct center of screen in terms of px. To test, I have tried placing an image at the center.
ImageView image = (ImageView)findViewById(R.id.imageView1);
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
image.setPadding(width/2,height/2,0,0);
I understand that there is an offset since setting the padding should place the image's top left corner in the center. Even so, the image comes out as too low and too far right. What kind of issue could be causing this?