I had an edit text which I wanted to make scrollable. The problem was that this edit text is located inside a scrollable view.
I searched the internet and found a solution that works fine. Source:How to scroll the edittext inside the scrollview
youredittext.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if (youredittext.hasFocus()) {
v.getParent().requestDisallowInterceptTouchEvent(true);
switch (event.getAction() & MotionEvent.ACTION_MASK){
case MotionEvent.ACTION_SCROLL:
v.getParent().requestDisallowInterceptTouchEvent(false);
return true;
}
}
return false;
}
});
The problem is after applying this solution the edit text would only scroll without a "velocity vector." So like you have to hold down your thumb and move it but the moment you remove your thumb it stops scrolling immediately.
While for example, the android scroll view has a velocity vector in which you scroll up fast then you remove your thumb, it would keep scrolling with decreasing speed. Similar to scrolling on Facebook and Instagram.
Any help is appreciated and thanks!