问题
I have many TextView
s and ImageView
s interleaved and I want to select one word of a TextView
with a long click. If I set all the TextView
s as selectable with mTextView.setTextIsSelectable(true)
the scroll doesn't work well and when I click over one of them, the view scrolls to set it as first element.
I thought that I could do something like:
mTextView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
mTextView.setTextIsSelectable(true);
return false;
}
});
But I have to perform the long click two times, one to set it as selectable and the second to select the word. And then I have to override something like onScroll
or onClick
to set the TextView
as not selectable again.
Someone knows some solution?
Edit: I need to select words of the TextView
s but I just want to perform the long click over that TextView
s. They are created in runtime and added to a FrameLayout
. Maybe I't could be possible perform all gestures on the FrameLayout
minus the onLongPress
...
来源:https://stackoverflow.com/questions/42598797/textview-selectable-just-on-long-click