How to scroll the edittext inside the scrollview
Try this..
Add below lines into your EditText
android:overScrollMode="always"
android:scrollbarStyle="insideInset"
android:scrollbars="vertical"
Example
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="15dp"
android:background="#eeeeee"
android:inputType="textMultiLine"
android:singleLine="false"
android:overScrollMode="always"
android:scrollbarStyle="insideInset"
android:scrollbars="vertical"
android:text="Android applications normally run entirely on a single thread by default the “UI thread” or the “main thread”.
android:textAppearance="?android:attr/textAppearanceMedium" >
</EditText>
EDIT
Programmatically
youredittext.setOnTouchListener(new 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;
}
});
Kotlin version
Add the following lines to the EditText in your xml:
android:overScrollMode="always"
android:scrollbarStyle="insideInset"
android:scrollbars="vertical"
Add this to the Activity/Fragment:
myEditText.setOnTouchListener { view, event ->
view.parent.requestDisallowInterceptTouchEvent(true)
if ((event.action and MotionEvent.ACTION_MASK) == MotionEvent.ACTION_UP) {
view.parent.requestDisallowInterceptTouchEvent(false)
}
return@setOnTouchListener false
}
First add this at XML
android:scrollbarStyle="insideInset"
android:scrollbars="vertical"
android:overScrollMode="always"
Then add the same above "OnTouch" but make it return "false" not "true"
public boolean onTouch(View view, MotionEvent event) {
if (view.getId() == R.id.DwEdit) {
view.getParent().requestDisallowInterceptTouchEvent(true);
switch (event.getAction()&MotionEvent.ACTION_MASK){
case MotionEvent.ACTION_UP:
view.getParent().requestDisallowInterceptTouchEvent(false);
break;
}
}
return false;
}