ListView inside scroll view magic

后端 未结 3 726
北海茫月
北海茫月 2021-01-21 03:32

For my app I want to enable a thing looking somehow like this:


    
        

        
3条回答
  •  佛祖请我去吃肉
    2021-01-21 03:47

    *     ListView lv = (ListView)findViewById(R.id.myListView);  
          lv.setOnTouchListener(new ListView.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                int action = event.getAction();
                switch (action) {
                case MotionEvent.ACTION_DOWN:
                    // Disallow ScrollView to intercept touch events.
                    v.getParent().requestDisallowInterceptTouchEvent(true);
                    break;
    
                case MotionEvent.ACTION_UP:
                    // Allow ScrollView to intercept touch events.
                    v.getParent().requestDisallowInterceptTouchEvent(false);
                    break;
                }
    
                // Handle ListView touch events.
                v.onTouchEvent(event);
                return true;
            }
        });k;
                }
                // Handle ListView touch events.
                v.onTouchEvent(event);
                return true;
            }
        });*
    

提交回复
热议问题