I have defined a LinearLayout with some TextView’s spread out.
Instead of putting a setOnTouchListener on each specific TextView, I like to divide my LinearLayout in three areas (hitareas).
If I hit the top area I do something (in the middle something else etc.).
I.e. I’d like to have three listeners for top, middle and bottom and in each area I have
any number of Android TextView’s (or possible other widgets) laid out.
How can I solve this?
Many thanks!
You can use one OnTouchListener and get the coordinates from the MotionEvent with getX() or getY() and calculate which third of the LinearLayout they touched.