Allow multi-line in EditText view in Android?

前端 未结 15 1748
既然无缘
既然无缘 2020-11-28 17:40

How to allow multi-line in Android\'s EditText view?

15条回答
  •  醉酒成梦
    2020-11-28 18:02

    Try this, add these lines to your edit text view, i'll add mine. make sure you understand it

    android:overScrollMode="always"
    android:scrollbarStyle="insideInset"
    android:scrollbars="vertical"
    
    
    

    and on your java class make on click listner to this edit text as follows, i'll add mine, chane names according to yours.

    EditText description;
    description = (EditText)findViewById(R.id.editText_newprom_description);
    
    description.setOnTouchListener(new View.OnTouchListener() {
                @Override
                public boolean onTouch(View view, MotionEvent motionEvent) {
    
                    view.getParent().requestDisallowInterceptTouchEvent(true);
                    switch (motionEvent.getAction() & MotionEvent.ACTION_MASK){
                        case MotionEvent.ACTION_UP:
                            view.getParent().requestDisallowInterceptTouchEvent(false);
                            break;
                    }
    
                    return false;
                }
    
            });
    

    this works fine for me

提交回复
热议问题