Answers for "how to make textview scrollable inside scroll view"

0

how to make textview scrollable inside scroll view

<AppCompatTextView
    android:id="@+id/actv"
    ...
    android:scrollbars="vertical" />
Posted by: Guest on November-02-2020
0

how to make textview scrollable inside scroll view

/**
 * If this [AppCompatTextView] is placed inside ScrollView then we allow it get scrolled inside
 * that ScrollView
 */
fun AppCompatTextView.makeScrollableInsideScrollView() {
    movementMethod = ScrollingMovementMethod()
    setOnTouchListener { v, event ->
        v.parent.requestDisallowInterceptTouchEvent(true)
        when (event.action and MotionEvent.ACTION_MASK) {
            MotionEvent.ACTION_UP -> {
                v.parent.requestDisallowInterceptTouchEvent(false)
                //It is required to call performClick() in onTouch event.
                performClick()
            }
        }
        false
    }
Posted by: Guest on November-02-2020

Code answers related to "how to make textview scrollable inside scroll view"

Browse Popular Code Answers by Language