Android: Context menu doesn't show up for ListView with members defined by LinearLayout?

Your CheckBox may be interfering with matters. Consider using a CheckedTextView instead of a LinearLayout CheckBox and TextView combination, since CheckedTextView is what Android expects for a CHOICE_MODE_MULTIPLE list Check out $ANDROID_HOME/platforms/$VERSION/data/res/layout/simple_list_item_multiple_choice. Xml where $ANDROID_HOME is wherever you installed the SDK and $VERSION is some Android version (e.

G android-2.1 ). This resource is the standard resource you should use for CHOICE_MODE_MULTIPLE lists. Feel free to copy it into your project and adjust the styling of the CheckedTextView as needed Here is a sample project showing a context menu used on a CHOICE_MODE_MULTIPLE ListView with CheckedTextViews as its rows.

Your CheckBox may be interfering with matters. Consider using a CheckedTextView instead of a LinearLayout, CheckBox, and TextView combination, since CheckedTextView is what Android expects for a CHOICE_MODE_MULTIPLE list. Check out $ANDROID_HOME/platforms/$VERSION/data/res/layout/simple_list_item_multiple_choice.

Xml, where $ANDROID_HOME is wherever you installed the SDK and $VERSION is some Android version (e.g. , android-2.1). This resource is the standard resource you should use for CHOICE_MODE_MULTIPLE lists. Feel free to copy it into your project and adjust the styling of the CheckedTextView as needed.

Here is a sample project showing a context menu used on a CHOICE_MODE_MULTIPLE ListView with CheckedTextViews as its rows.

Thanks, that worked perfectly! – RandomEngy May 23 '10 at 17:12 Well maybe not quite. View bindings don't work anymore.It appears that when the CheckedTextView items are part of a list, you can't check them manually.

– RandomEngy May 23 '10 at 22:45 Use setItemChecked() on your ListView. – CommonsWare May 23 '10 at 22:49.

Context menu's can only be registered to subclasses of View. I don't know how you registered the LinearLayout with a context menu, did you package it in some type of View? If so, you should post that code.

Anyways why not just register the TextView of each list item? Who would long press a checkbox...

Thanks. I added the line where I register the context menu. Should I be registering each TextView in the list instead?

Would I need to re-register when items are added? – RandomEngy May 23 '10 at 5:10 1 LinearLayout is a View. – CommonsWare May 23 '10 at 12:09.

This should from a regular ListView as well. But if you're starting from scratch on a new list I would consider using the CheckedTextView checkBox. SetOnLongClickListener(new View.

OnLongClickListener() { public boolean onLongClick(View v) { // return false to let list's context menu show return false; } }).

Your CheckBox may be interfering with matters. Consider using a CheckedTextView instead of a LinearLayout, CheckBox, and TextView combination, since CheckedTextView is what Android expects for a CHOICE_MODE_MULTIPLE list. Check out $ANDROID_HOME/platforms/$VERSION/data/res/layout/simple_list_item_multiple_choice.

Xml, where $ANDROID_HOME is wherever you installed the SDK and $VERSION is some Android version (e.g. This resource is the standard resource you should use for CHOICE_MODE_MULTIPLE lists. Feel free to copy it into your project and adjust the styling of the CheckedTextView as needed.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions