Android Long Press the ListView cannot eject Contextmeun

Source: Internet
Author: User

Possible causes: Onitemlongclick consumption of long press events
  
  1. mListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
  2. @Override
  3. /span>public boolean Onitemlongclick adapterview <?> parent view View , Span class= "PLN" > int position long ID ) Span class= "PLN" > {
  4. mApSelect = position;
  5. Log.d(TAG, "onItemLongClick:" + mApSelect);
  6. return false;
  7. }
  8. });
Key inOnitemlongclickThe return value of the function, see the document Comment:
  
  1. /**
  2. * Callback method to be invoked when an item in this view has been
  3. * clicked and held.
  4. *
  5. * Implementers can call getItemAtPosition(position) if they need to access
  6. * the data associated with the selected item.
  7. *
  8. * @param parent The AbsListView where the click happened
  9. * @param view The view within the AbsListView that was clicked
  10. * @param position The position of the view in the list
  11. * @param id The row id of the item that was clicked
  12. *
  13. * @return true if the callback consumed the long click, false otherwise
  14. */
If Ture is returned, the system considers that the user-implemented callback function has finished processing the long-press event. The popup ContextMenu is also a long-press-event response, and theOnitemlongclickAfter the response, returning true causes ContextMenu not to eject.

From for notes (Wiz)

Android Long Press the ListView cannot eject Contextmeun

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.