Last active
October 24, 2017 01:11
-
-
Save oligazar/cc866d55104ee102156dc31d196b1d71 to your computer and use it in GitHub Desktop.
When soft keyboard is present it's impossible to make EditText content scroll. Only with custom textListener that disallows touch event interception.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<android.support.v7.widget.AppCompatEditText | |
android:id="@+id/etText" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_marginEnd="@dimen/spacing_normal" | |
android:layout_marginLeft="@dimen/spacing_normal" | |
android:layout_marginRight="@dimen/spacing_normal" | |
android:layout_marginStart="@dimen/spacing_normal" | |
android:layout_marginTop="@dimen/spacing_normal" | |
android:ems="10" | |
android:hint="@string/hint_text" | |
android:inputType="text|textMultiLine" | |
android:overScrollMode="always" | |
android:maxLines="3" | |
android:scrollbars="vertical"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
etText.setOnTouchListener { v, event -> | |
if (v.id == R.id.etText) { | |
v.parent.requestDisallowInterceptTouchEvent(true) | |
when (event.action and MotionEvent.ACTION_MASK) { | |
MotionEvent.ACTION_UP -> | |
v.parent.requestDisallowInterceptTouchEvent(false) | |
} | |
} | |
false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment