How to Set the MovementMethod in a TextView
added in API Level 1Sets the movement method (arrow key handler) to be used for this TextView. This can be null to disallow using the arrow keys to move the cursor or scroll the view.
Be warned that if you want a TextView with a key listener or movement method not to be focusable, or if you want a TextView without a key listener or movement method to be focusable, you must call
1. Find the TextView using IDsetFocusable(boolean)
again after calling this to get the focusability back the way you want it.2. In the MainActivity.java file, add the code below to the imports section.
import android.text.method.ScrollingMovementMethod;
3. In the MainActivity.java file, add the code below to the onCreate method, after the findViewById line of code.
myTextView.setMovementMethod(new ScrollingMovementMethod());
4. Compile and run!
Related Articles:
Resources: