locked
Creating a popup window on button click RRS feed

  • Question

  • User329069 posted

    So I am pretty new to Xamarin, and I have a main page with 3 buttons. Each of those buttons opens a popup which displays one or two small images (depending on the popup) and a small sentence. Coding the layout of the popups itself is easy enough, but how does one cause the buttonClick to trigger the popup event? and would each popup have its own axml file or should this all be done in the Main.axml file ( which contains the 3 buttons and their formatting). I am specifically told that these buttons cannot open to new activities, and they should just appear as popup window that takes up the whole screen.

    I was originally trying to use 3 fragments that would open on each button click, but I was not able to make it work and it seems like the popup window could accomplish a similar result that would meet my criteria.

    Wednesday, June 7, 2017 10:59 AM

Answers

  • User244003 posted

    Hiii @AkhilioM

    The below links useful for you.

    https://developer.xamarin.com/samples/monodroid/PopupMenuDemo/

    https://github.com/rotorgames/Rg.Plugins.Popup

    https://forums.xamarin.com/discussion/58537/close-the-pop-up-window-on-click-outside

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, June 7, 2017 11:13 AM
  • User258468 posted

    Just follow the vanilla Android docs...don't use a third-party library to accomplish a trivial task. Here is what you're looking for.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, June 8, 2017 8:35 PM

All replies

  • User2148 posted

    I think you can use AlertDialog.

    This is Java docs, but I think you can create it also in csharp

    https://developer.android.com/guide/topics/ui/dialogs.html

    Wednesday, June 7, 2017 11:02 AM
  • User172986 posted

    I'd use the xamarin plugin rgPopups, on nuget here https://github.com/rotorgames/Rg.Plugins.Popup, plus its xamarin forms compatible so you can go cross platform if you want

    I've used it before and it's really good

    Wednesday, June 7, 2017 11:04 AM
  • User244003 posted

    Hiii @AkhilioM

    The below links useful for you.

    https://developer.xamarin.com/samples/monodroid/PopupMenuDemo/

    https://github.com/rotorgames/Rg.Plugins.Popup

    https://forums.xamarin.com/discussion/58537/close-the-pop-up-window-on-click-outside

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, June 7, 2017 11:13 AM
  • User325526 posted

    Hi, try follow this video, works for me when i need to open popup

    https://www.youtube.com/watch?v=j_0s9IslwYs

    Wednesday, June 7, 2017 5:32 PM
  • User258468 posted

    Just follow the vanilla Android docs...don't use a third-party library to accomplish a trivial task. Here is what you're looking for.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, June 8, 2017 8:35 PM
  • User320645 posted

    @felipe1902 I have done this video too, but I can not handle the orientation change / when rotate the screen. Do you how to do it?

    And this video is for dialog fragment not for popup

    Friday, June 9, 2017 10:17 AM
  • User325526 posted

    @TripleDouble do you did with dialog fragment or just dialog? post your code..

    Friday, June 9, 2017 11:42 AM
  • User320645 posted

    @felipe1902

    dialog fragment

    https://forums.xamarin.com/discussion/95858/dialog-fragment-handling-rotation-changes#latest

    Friday, June 9, 2017 12:33 PM