Development requirements: The title Item has title and description, but the description height control in 8 lines of height can be scrolled to see the extra part

The event distribution mechanism of the Android control ViewGroup is based on the principle of distributing blocking consumption from top to bottom

The concrete implementation is as follows:

 mRecyclerQuestionDView.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() {
            @Override
            public boolean onInterceptTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) {
                View view = rv.findChildViewUnder(e.getX(), e.getY());
                if(view ! =null) {
                    RecyclerView.ViewHolder viewHolder = rv.getChildViewHolder(view);
                    if (viewHolder instanceof QuestionDetailAdapter.HeaderViewHolder) {
 // Returns whether to intercept touch eventsrv.requestDisallowInterceptTouchEvent(((QuestionDetailAdapter.HeaderViewHolder) viewHolder).isTouchNsv(e.getRawX(), e.getRawY())); }}return false;
            }

            @Override
            public void onTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) {}@Override
            public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {}});/ * * *@paramX rowX * of the event@paramY rowY * of the event@returnThis point is outside the range of item. */
        public boolean isTouchNsv(float x, float y) {
            int[] pos = new int[2];
            // Get the position of the SV on the screen
            scrollV.getLocationOnScreen(pos);
            int width = scrollV.getMeasuredWidth();
            int height = scrollV.getMeasuredHeight();
            return x >= pos[0] && x <= pos[0] + width && y >= pos[1] && y <= pos[1] + height;
        }          
Copy the code