0

Scrollbar is showing but not working or scrolling as shown in image below

TextView with Scrollbar

XML:

<TextView
    android:id="@+id/text_view_dialog_notes"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="7dp"
    android:layout_marginRight="7dp"
    android:hint="@string/rv_notes_content"
    android:padding="5dp"
    android:scrollbars="vertical"
    android:minLines="10"
    android:maxLines="10"
    android:textSize="17sp" />

Where is something wrong and how to fix it?

Adeel Iftikhar
  • 772
  • 7
  • 30

2 Answers2

3

Using scrollbar on textView

you have to add this line in java

textView.setMovementMethod(new ScrollingMovementMethod());
Muhammad Ashfaq
  • 2,359
  • 5
  • 20
  • 46
1

make sure you add that to your code:

yourTextView.setMovementMethod(new ScrollingMovementMethod());
Nikos Hidalgo
  • 3,666
  • 9
  • 25
  • 39