I want to place spinning wheel progress bar at (x, y) location in relative layout. To do that, I have to know the size of progress bar. How do I know size of progress bar? Is there better way than this?
ProgressBar pb = new ProgressBar(context, null, android.R.attr.progressBarStyleSmall);
params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
params.leftMargin = x - pb.getWidth() / 2; // pb.getWidth() returns 0
params.topMargin = y - pb.getHeight() / 2;
addView(pb, params);