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?
Related
When the user opens the app for the first time, I want my app to have a custom popup box or a popup model next to a button so which tells what a button does
Here's an example -
I can use sharedpreferences to make it visible only for the first time.
But, how do I make it?
you can use Dialog and customize the position and appearance of it i leave some links below to know how to do it:
diologs on android:
https://developer.android.com/guide/topics/ui/dialogs
changing position of dialog:https://www.tutorialspoint.com/how-to-change-the-position-of-the-dialog-on-screen-android
creating custom dialog using Material design:
https://material.io/components/dialogs/
for customizing dialog there is outer ways to but material design is simpler
What I want to do is to show the dialog message but make it still possible to click on the items behind. On any click, the dialog would dismiss
Right now I need to click once to dismiss the dialog and a second time to click on a field.
It is something possible ? Or is there an alternative to using Dialogs?
Edit: Solution found by adding Layout Flags to the window.
In kotlin:
dialog.window?.setLayout(ConstraintLayout.LayoutParams.FLAG_NOT_FOCUSABLE, ConstraintLayout.LayoutParams.FLAG_NOT_FOCUSABLE)
By using Dialog you cannot achieve what you are looking for. instead of using Dialog USE FRAGMENT.
The examples are given in official documentation here.
You Can define a full layout in the background of the dialog and set onClick listener to that layout
When I switch from Activity to AppCompatActivity in Android development, the dialog box seems to have a UI issue.
Here's how the dialog buttons look like using Activity:
Here's how the dialog buttons look like using AppCompatActivity:
Crop Photo is the Positive button, Full Photo is the neutral button, and the cancel buttons looks out of place. Can this be fixed or do I overlook anything?
I have also tried using import android.support.v7.app.AlertDialog or the default android AlertDialog, both result is the same.
This is how material design works. The affirmative action (the positive button) is always placed on the right, then on the left of it is the dismissive action.
Technically the guideline says that "Dialogs should not include more than two actions.", but it is fine if it doesn't leave the dialog in an indeterminate state. However, you may want to create your own dialog layout with a list instead of relying simply on the action buttons if you think the look-and-feel is bad.
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.
I want to have a popup dialog with OK/Cancel and two spinners.
(1) Is this possible?
(2) Has this been done in any other apps?
Thanks
Yes that's possible take a look at how to implement custom dialogs:
http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog