Android: onTouch for Spans in Spannable Text?

Copied from the ArrowKeyMovementMethod source code, you could try to use the following snippet of code: private int getOffset(int x, int y, TextView widget){ // Converts the absolute X,Y coordinates to the character offset for the // character whose position is closest to the specified // horizontal position. X -= widget. GetTotalPaddingLeft(); y -= widget.

GetTotalPaddingTop(); // Clamp the position to inside of the view. If (x = (widget.getWidth()-widget. GetTotalPaddingRight())) { x = widget.getWidth()-widget.

GetTotalPaddingRight() - 1; } if (y = (widget.getHeight()-widget. GetTotalPaddingBottom())) { y = widget.getHeight()-widget. GetTotalPaddingBottom() - 1; } x += widget.getScrollX(); y += widget.getScrollY(); Layout layout = widget.getLayout(); int line = layout.

GetLineForVertical(y); int offset = layout. GetOffsetForHorizontal(line, x); return offset; } Hope that helps, EdenSphere.

I have a TextView and it is inside a LinearLayout. I implement onTouchListener for the LinearLayout. OnTouch() event of the LinearLayout does not work.

Does anyone have a solution?

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