-1

I have textview that include a large text and fill the parent layout.but i don't want to use Scrollview and i want to change the textview properties. How Can I scroll the textview Vertically?

AskNilesh
  • 63,753
  • 16
  • 113
  • 150
mohamad sheikhi
  • 352
  • 5
  • 15

3 Answers3

3

You can make textview as a child of scrollView, and make textview as height as wrap content.

AskNilesh
  • 63,753
  • 16
  • 113
  • 150
Blur Pixel
  • 41
  • 5
  • This is the best answer I read about how to make a textview scrollable. I tried everything and it wouldn't work until I set height of textview as wrap_content. – Geoffroy CALA Nov 09 '19 at 22:30
1

One general way to do this would be wrap your top level layout in a <ScrollView>, something like this:

<ScrollView
    android:id="@+id/yourScrollView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="60dp">
     <LinearLayout
         android:id="@+id/yourMainLayout"
         android:orientation="vertical"
         android:padding="12dp"                 <!-- add your other content here -->
         android:layout_width="match_parent"
         android:layout_height="wrap_content">
     </LinearLayout>
</ScrollView>

Then, inside the above LinearLayout you may add one or more TextView.

AskNilesh
  • 63,753
  • 16
  • 113
  • 150
Tim Biegeleisen
  • 451,927
  • 24
  • 239
  • 318
0

In the textview xml Add this:

android:scrollbars = "vertical"
AskNilesh
  • 63,753
  • 16
  • 113
  • 150