What I want to do: A list with messages like this:
and here is the mnessage the user writes, that will wrap nicely to the next line.
This is happened because when we press on list item it sends the press event to all its children, so the child's setPressed calls rather than the list item. Hence for clicking the list item, you have to set the child's setPressed to false. For this, you have to make custom TextView class and override the desired method. Here is the sample code
public class DontPressWithParentTextView extends TextView {
public DontPressWithParentTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void setPressed(boolean pressed) {
// If the parent is pressed, do not set to pressed.
if (pressed && ((View) getParent()).isPressed()) {
return;
}
super.setPressed(pressed);
}
}