1

Is there any way to disable getView() method in ListView Adapter when I use MotionEvent.ACTION_MOVE in OnTouchListener??

I need to do because i try move my conteiner(inside is my ListView) by finger. I use for this method setLayoutParams:

    private class MyListener implements View.OnTouchListener{

    @Override
    public boolean onTouch(View v, MotionEvent event) {

        final int Y = (int) event.getRawY();

        switch (event.getAction() & MotionEvent.ACTION_MASK) {
            case MotionEvent.ACTION_UP:
                RelativeLayout.LayoutParams paramsUp = (RelativeLayout.LayoutParams) myBar.getLayoutParams();
                paramsUp.topMargin = 0;
                myBar.setLayoutParams(paramsUp);
                break;
            case MotionEvent.ACTION_MOVE:
                RelativeLayout.LayoutParams paramsMove = (RelativeLayout.LayoutParams) myBar.getLayoutParams();
                paramsMove.topMargin = Y - yDelta;

                myBar.setLayoutParams(paramsMove);
                break;
            case MotionEvent.ACTION_DOWN:
                RelativeLayout.LayoutParams lParams = (RelativeLayout.LayoutParams) myBar.getLayoutParams();
                yDelta = Y - lParams.leftMargin;
                break;
        }
        //myBar.invalidate();

        return true;
    }

}

When I moving container, everything happens very slowly. This is because the container changes its size and all objects are loaded again.

And my second question: How to disbale scroll when I move ListView item? For example: move on left or move on right.

Thx

kazhiu
  • 749
  • 9
  • 21
  • I dont know of any way in which you can get rid of the getView() method, this method is the crux of listview. You might have to reconsider the decision of using a listview and instead use a custom layout. Fiddling with the scroll of listview is highly not recommended. Please watch this video: http://www.youtube.com/watch?v=wDBM6wVEO70 – Skynet Sep 02 '13 at 09:37

0 Answers0