I have created a custom circular ProgressBar following this. Now I want to add this progress bar to the center of my layout. The problem is that it is added to the top left of the activity, no matter how I change LayoutParams attributes passed to addView(). The code is as follows:
// Create a progress bar to display while the list loads
mProgressBar = new DualProgressView(getApplicationContext());
ViewGroup root = findViewById(android.R.id.content);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(500, 500, Gravity.CENTER);
root.addView(mProgressBar,params);