标签:java io for ar cti line sp ad on
判断textView 点击的某一行
@Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: int x = (int) event.getX(); int y = (int) event.getY(); x -= getTotalPaddingLeft(); y -= getTotalPaddingTop(); x += getScrollX(); y += getScrollY(); Layout layout = getLayout(); int line = layout.getLineForVertical(y);//列 int off = layout.getOffsetForHorizontal(line, x);//此列上的位置 break; } return super.onTouchEvent(event); }
标签:java io for ar cti line sp ad on
原文地址:http://my.oschina.net/u/1781028/blog/306200