I'm trying to find background view reference for a default AlertDialog. This is because I want to add a BrokenWindow animation when the dialog is closed.
I browsed the layout for (holo) AlertDialog and the name of the id is #+id/parentPanel
How can I get this reference?
I cannot use findViewById(), since R.id.parentPanel is obviously not present in my resource.
Any other way than having a custom layout for my alert dialog?
Thanks for help
you should use a custom layout for your alert dialog. then you can use getView().findViewById(R.id.*your custom layout*); to access. Its really simple to use a custom layout for your dialog and you can find out how in this post: How to implement a custom AlertDialog View
Related
I have to implement the filters as shown in the image. Which view or component can I use? Popup view or Alert dialog or anything else?
Also, I have implemented my list using an array adapter and I have filter items in that.
[enter image description here][1]
[1]: https://i.stack.imgur.com/3fuWG.jpg
I'd recommend you to use dialog fragments.
You can read my article on medium on how to create dialog fragment
https://islamassem.medium.com/custom-dialog-using-dialog-fragments-de6a0874b6a4
I need to do a dialog like DatePicker or TimePicker, but the dialogue should display my data. Is this possible, or do I need to do a custom view for this?
Sorry, but I can't comment because I don't have enough rep.
There isn't a ready out of the box dialog that allows custom data to be set. I supposed the best approach would be to create a custom layout with a NumberPicker and then set it as your dialog's view.
This answer should point you to right direction.
I have an activity that I display to the user as a dialog via a change in the manifest:
android:theme="#android:style/Theme.Holo.Dark.Dialog"
I haven't been able to find any help regarding how to change the divider via this method of calling a dialog - only from typical dialog code.
setDivider doesn't seem to be supported.
Thanks for any help.
i am looking for ways to change the default color of alert box in android to different color like green or blue. please suggest me ways with exampls
Hi there are you try the following.
1)using setview method of alertdialog to set the view and set the view background as per your choice.
2)you can set the your user defined theme and use it in constructor of your dialog.
3)extend dialog class and in oncreate method decorate your dialog box as per your need.
I just shared the idea with which you can achieve your need.For more info visit the following link.
http://developer.android.com/reference/android/app/AlertDialog.html
cheers...
Is it possible to have an Android Alert box or Dialog off-center? I have tried everything that comes to mind, including making a custom Dialog activity and theme (extending Android:Theme.Dialog), but I have not been able to move it from it's centered position.
Yes you can make the background translucent and fill the entire view, then nest a visible layout within that you can use layout_gravity="top|left" on.
A little off topic, but if you just want to display text, an easier way is to use a toast.
Toast toast = new Toast(new ContextThemeWrapper(getApplicationContext(), R.style.YourDialogStyle));
toast.setGravity(Gravity.LEFT|Gravity.TOP, 0,0);
PopupWindow? An example can be found here: http://www.anddev.org/how_to_create_a_popupwindow-t1259.html