My Dialog box looks like this.
d = new Dialog(context);
d.requestWindowFeature(Window.FEATURE_NO_TITLE);
d.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
d.setContentView(R.layout.layout_new);
// Extra Initializations
d.show();
My Log
it wont appear on android nougat 7.0
Screen just gets dark (normally like behind a dialog box)
Clicking on black empty area dismiss the dialog box(which is invisible)
Does any one have a solution to fix this ?
Thank you so much in advance.
Related
I am a beginner in android programming and I have noticed, that my tablet Sony Xperia Z4 (Android 6.0) got an alert dialog with 3 buttons: positive, negative and the other one, see in the picture below. This is main menu, not my application.
Alert Dialog info button
My question: is this a custom dialog? I have never met with this type of button in alert dialog.
Thank you.
EDIT:
Duplicate? I don't think so...
AlertDialog.Builder with custom layout and EditText; cannot access view
Why?
User got a problem with accessing an edit text in his dialog.
My question is, if dialog in my tablet is CUSTOM. Nothing else :)
This is not an AlertDialog, instead is just a Dialog with a custom layout, you can do it, you can bind buttons and views to a Dialog and make a custom one like the image you posted. Here is a post that might help you out
How to create a Custom Dialog box in android?
How to make a dialog like this example? (On the RIGHT)
If you look close, the dialog overlap the status bar and it has a very tiny margin from smartphone border...
How can I do this?
It looks like a dialog. Try to create a custom Activity as Dialog with some views. I hope it helps you.
https://developer.android.com/guide/topics/ui/dialogs.html#FullscreenDialog
Android Activity as a dialog
I've created a Dialog that appears when a button is clicked. I made a custom layout for it and coded it like this:
final Dialog dialog = new Dialog (CheckpointsActivity.this, android.R.style.Theme_Translucent);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.alert_continue);
//rest of the code...
This is how the Dialog looks now:
And this is how I want it to look like:
It should be a lot darker in the background with a gradient effect. I can't seem to find any info on how to achieve this.
You can make a dialog box with the same background and gradient and then make the ui on top of that.
I have an app where the user presses a button and a custom spinner is popped so that the user can choose between nine colors. I want the spinner to be dismissed, when the user touches the background (every place on the sreen except from the spinner). Is this possible?
I tried to add an onTouchListener on the image that covers the background and call
dialog.dismiss();
but it does not work.
My spinner is custom Spinner, set in an xml file and popped with:
final Dialog dialog = new Dialog(this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.colorchooser);
Thank you in advance
First of all you should be able to add
dialog.setCanceledOnTouchOutside(true);
to accomplish what you want.
But the dismiss() method should also be working, I would guess that the place your are calling dialog.dismiss() is not reachable at the current moment.
I'm new at android development so be patient with me.
I have an app which shows a pop up window containing a 'next' button. when it is clicked, previous one closes and new one opens with different information.
the problem is when this button is clicked in very high rate, some times previous dialog window stays and the new window appears at the same time. this does not happen every time. Dialog is used to create the popup window. dialog.dismiss() is used every time the next button is clicked. I'm trying to fix this in case if some user try to do the same thing.
in the button action
dialog.dismiss();
nextaction();
the nextaction() contains the initilization and the image and textloading to the popup window
some thing like
dialog = new Dialog(ctx);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.popupview);
(dialog is global variable)
So can any one be kind enough to give some suggestions. thanks in advance