views:

52

answers:

0

Hello, i wanna update a ListView on catching the event onFling on its headerview,but it is no effect.

the headerview:(R/layout/browser_header.xml)

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="100dip" android:focusable="false">
<TextView android:id="@+id/updatedTime" android:layout_height="100dip"
        android:layout_width="fill_parent" />
</LinearLayout>

the code:

View header = getLayoutInflater().inflate(R.layout.browser_header,
                null);
        header.setOnTouchListener(this);

        listView.addHeaderView(header);

        gestureDetector = new GestureDetector(this, gsl);

.....

@Override
    public boolean onTouch(View v, MotionEvent e) {
        return gestureDetector.onTouchEvent(e);
    }

private final SimpleOnGestureListener gsl = new SimpleOnGestureListener() {

    @Override
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
            float velocityY) {
        Toast.makeText(BrowserActivity.this, "onFlip", Toast.LENGTH_SHORT)
                .show();
        return false;
    }
};

I did this success on other views, is it the ListView cause it?

Thank you very much!