android scrollable textview inside scrollview

后端 未结 5 1539
無奈伤痛
無奈伤痛 2020-12-17 14:38

i need to create like scrolling TextView inside the ScrollView.. like 1 main ScrollView inside that scrollable TextView i

5条回答
  •  执笔经年
    2020-12-17 15:14

    This problem is a little complicated and I don't have enough time to explain, but you can easily get rid of it by adding these onTouch classes at the end of onCreat class or onCreatView class (if you are using fragment).

    scrollview1.setOnTouchListener(new OnTouchListener() {
    
                @Override
                public boolean onTouch(View v, MotionEvent event) {
    
                    tv_desc.getParent().requestDisallowInterceptTouchEvent(false);
    
                    return false;
                }
            });
    
    tv_desc.setOnTouchListener(new OnTouchListener() {
    
                @Override
                public boolean onTouch(View v, MotionEvent event) {
    
                    tv_desc.getParent().requestDisallowInterceptTouchEvent(true);
    
                    return false;
                }
            });
    

    and also for other textviews.

提交回复
热议问题