-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
  • 67,701
  • 16
  • 123
  • 163
mohamad sheikhi
  • 394
  • 5
  • 16

3 Answers3

3

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

AskNilesh
  • 67,701
  • 16
  • 123
  • 163
Blur Pixel
  • 51
  • 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
  • 67,701
  • 16
  • 123
  • 163
Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360
0

In the textview xml Add this:

android:scrollbars = "vertical"
AskNilesh
  • 67,701
  • 16
  • 123
  • 163