Custom popup box android studio - android

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

Related

How to bypass android dialog outside click

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

Issue with dialog box using AppCompatActivity

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.

Is there a way to show an Android dialog without graying out the back drop?

I want to pop open a DatePickerDialog in a certain screen, but I am required to not grey out the rest of the screen (the view behind the dialog) when the DatePickerDialog window opens. Is there a way to achieve this?
You probably would want to create your own custom dialog. You can extend DialogFramgent and change it accordingly.
See the Android doc HERE for a great example.
Or, use PopupWindow if you want a popover dialog with control of the background, see this SO post.

What is the best UI design for picking object icon in Android?

I have an Activity which provides UI for editing entity properties such as name, description an so on. This entity can also have an icon but (this is the main problem) can have no icon. I have created an icon picker activity which provides UI for icon selection. But I can not think of a simple and pretty way to provide access to this picker from parent activity. It could be a simple image button if the task was just to select an icon but I have also to make it possible to remove already set icon. Having two buttons with 'choose' and 'remove' seems ugly. Any smart ideas?
UPDATE
I've ended with ImageButton showing selected icon or special 'No' icon if object has no icon. On button click I show PopupMenu on 3.0+ and ContextMenu on older versions. Menu contains 'Change' and 'Remove' items.
You could have a border that surrounds an empty space or the image if there is one already.
If the image exists, clicking on it brings up a dialog where you can choose to change it or remove it.
If it doesn't exist, clicking on it brings up a dialog where you can add it.
how about a gridview within a custom dialog fired from your parent activity??
change the icon onItemSelected() of the gridview??

How to create a custom PopUp Menu

I would like to create a custom PopUp menu in Android like the one in the attached screenshot. Any pointers would be appreciated.
On click of the button "Choose Name" , you see a PopUp menu just below the button.
Thaknks.
You should take a look at building custom dialogs. In Android, a Dialog is typically in the form of a popup window. You can also do this with an Activity and apply the Dialog theme to it (mentioned in this link).
Sana,
You will probably want to look into creating a custom Dialog for your application: http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog

Categories

Resources