So I would like to add a custom imageview to a ProgressDialog:
LinearLayout root = (LinearLayout)findViewById(R.id.root);
ProgressDialog pdialog = new ProgressDialog(context);
pdialog.setTitle("Wait");
pdialog.setMessage("Loading...");
pdialog.addContentView((ImageView)findViewById(R.id.imageV3iew1), root.getLayoutParams());
pdialog.setCancelable(false);
pdialog.show();
It says that the specified child already has a parent and I have to call removeView on the parent first. I know how to create custom dialogs but I would like to append my imageview right to the ProgressDialog. What kind of feature do I need to request?
I had the same problem. Check out this solution: https://stackoverflow.com/a/10070995/1487456
Basically, you need to call .show() before you call .setContentView() and therefore probably .addContentView() also.
You can then inflate a layout and customise it however you wish.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With