help with showing a contextmenu when a list view item is long

hello everyone.

i am building a xamarin android app, and i want to implement a whatsapp based feature that include showing a contextmenu when a list view item is long clicked.
here's a picture of the feature i want: https://us.v-cdn.net/5019960/uploads/editor/kt/bdt1pn53q8ac.jpg

i searched for an answer and found a solution for xamarin forms, and i'd like to know is there a similar solution for xamarin android
here's the link: https://forums.xamarin.com/discussion/106218/how-to-implement-whatsapp-like-contextmenu-item-bar-in-xamarin-forms

thanks.

Answers

  • hexagodhexagod Member ✭✭✭

    could you check the length of your array and then put some if else logic to switch between them based on the length of that array?

  • mega5800mega5800 USMember ✭✭
    Hello @hexagod

    Thank you for your help, but I need more details, such as code examples, or at least links with help.

    Does anyone else got a solution?
    Thanks
  • hexagodhexagod Member ✭✭✭

    how about show us what you've got so far and we'll edit the code with you

  • mega5800mega5800 USMember ✭✭
    I won't upload my code.
    If you can't help me with code examples or any other help, please don't waste my time
  • hexagodhexagod Member ✭✭✭

    You need to show us your code so we can help you but here's a quick example:

    //get size of array as int from array length property
    int sizeOfArray = array.Length;

    //our cutoff size will control when the view changes
    int mySizeCutoff = 6;

    //if the size of array is greater than the size cutoff int...
    if (sizeOfArray > mySizeCutoff)
    {
    //...hide the listview
    myListView.Visibility = ViewStates.Invisible;
    //..show the contextview
    myContextView.Visibility = ViewStates.Visible;
    }
    // if the size of the array is less than our cutoff int...
    else if (sizeOfArray < mySizeCutoff)
    {
    //.. show the listview
    myListView.Visibility = ViewStates.Visible;
    //..hide the contextview
    myContextView.Visibility = ViewStates.Invisible;
    }

  • hexagodhexagod Member ✭✭✭

    @mega5800 said:
    I won't upload my code.
    If you can't help me with code examples or any other help, please don't waste my time

    You won't upload your code and you don't want me to waste your time......... OKKKKKKKKKKKK BRO yeah let me just do a bunch a research for YOUR WORK when you won't even share what you're trying to do. WOW

  • jezhjezh Member, Xamarin Team Xamurai

    Attachment is a sample about contextmenu In xamarin android, you can check it.

Sign In or Register to comment.