How to get location (on screen) of row in listview
<p>I have implemented some gesture detection code so that I can detect when a row in my listview (which is situated in a FrameLayout) has been swiped.</p>

<pre><code>public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
    if (e2.getX() - e1.getX() &gt; SWIPE_MIN_DISTANCE &amp;&amp; Math.abs(velocityX) &gt; SWIPE_THRESHOLD_VELOCITY) {
        int itemId = MainActivity.this.getListView().pointToPosition((int) e1.getX(),(int) e1.getY());
        Offer order = (Offer)MainActivity.this.getListView().getAdapter().getItem(itemId);
        View v = MainActivity.this.getListView().getChildAt(itemId);
    }
}
</code></pre>

<p>I want to display a view over the top of the swiped row with a set of context sensitive options for that row.</p>

<p>My problems is that the following methods:</p>

<pre><code>v.getTop()
v.getBottom()
</code></pre>

<p>return correct values only before the view has been scrolled. I could probably do some calculation to work out offsets using scroll positions etc but I also noticed that I only get values when I swipe a row that is visible on screen to begin with.  If I scroll down the list and then swipe a row (that was not originally off-screen) then these methods return null values.</p>

<p>The methods below seem to suffer from the same problem...</p>

<pre><code>v.getLocationOnScreen(loc)
v.getLocationInWindow(loc)
</code></pre>

<p>Ultimately, I am looking to find the distance between the top of the visible listView and the row that has been swiped. I will then use this distance to add a view to the parent FrameLayout with the appropriate height padding (so that it covers the swiped row).</p>

<p>Any help would be much appreciated!</p>
