Scrolling with Multiple ListViews for Android

前端 未结 6 997
孤城傲影
孤城傲影 2020-11-29 04:46

I\'m completely stumped on this one. I have three different lists that need to be displayed on the screen. It\'s completely possible that the lists will extend past the bot

6条回答
  •  长情又很酷
    2020-11-29 05:18

    Forward touch event from touched view to other views. All your views will be synchronized expand/collapsed too.

       OnTouchListener mOnTouch = new OnTouchListener()
        {
            @Override
            public boolean onTouch(View v, MotionEvent event)
            {            
                MotionEvent newEvent = MotionEvent.obtain(event);
                switch(event.getAction()){  
                case MotionEvent.ACTION_MOVE:
                    if(mTouched == null){
                        mTouched = v;
                    }
                    mMovingFlag = true;
                    break;
                case MotionEvent.ACTION_UP:
                    if(mMovingFlag==false){
                        newEvent.setAction(MotionEvent.ACTION_CANCEL);
                    }
                    mMovingFlag = false;
                    break;
                default:
                    mMovingFlag = false;
                    if(mTouched != null && mTouched.equals(v)){
                        mTouched = null;
                    }
                    break;
    
                }
                if(mTouched == null || mTouched.equals(v)){
                    int items = mLayoutWithListViews.getChildCount();
                    for(int list=0; list

提交回复
热议问题