0

enter image description here

Sorry if I somehow missed the answer to my question, I was trying to find it. So, the problem is when I put my textView into ScrollView I faced a little problem. In the beginning I had always had to scroll my text down myself. Then I added

<TextView
  ...
  android:layout_gravity="bottom"
>

And faced another problem. Now my text appears in bottom, just like what I needed, but I can't scroll my text up to see what text I missed, for instance, it just doesn't scroll now. At all.

<TextView
    ...
    android:layout_gravity="top"
>

With this setting Text appears in top, no autoscrolldown, but at least I can scrolldown myself. Why with layout_gravity="bottom" I can't scroll?

Denis
  • 17
  • 1
  • 9
  • please use Edit text instead of Text view and set editable false property of that and remove scroll view no need for scroll view. – Ricky Patel Apr 27 '17 at 10:16
  • Please provide the screenshots – Aldrin Joe Mathew Apr 27 '17 at 10:18
  • If I don't use layout_gravity="bottom" text doesn't scrolldown itself (which is obvious), but I can scroll it down myself. But when I added gravity text scrolls down itself, but I can't scroll it up... I'll try to use Edit Text later, but I didn't notice setEditable method there.. Quite new to android, sorry – Denis Apr 27 '17 at 10:24

3 Answers3

2

Add text view after close of scrollview and add property for text view which you want like: ...... ......

Ashish Garg
  • 162
  • 1
  • 11
  • It worked, thanks, just needed to change layout_gravity to just gravity. Thank you very much. Only one thing is making me sad now: scrolling is not that smooth anymore – Denis Apr 27 '17 at 10:50
0

I think u should look at the problem in a different perspective. Look at this

https://stackoverflow.com/a/3080483/5852891

Contents should not over flow from screen view port. That is the rectangle part of the screen that is renders display.

Design Preview of designing apps in android

See the contents must fit in the screen. This can be set with layout weights and positioning codes.

Community
  • 1
  • 1
Manasvini Ganesh
  • 483
  • 5
  • 16
  • But with layout_gravity="top" scrolling in both sides works, that's why I can't understand where is the problem. I don't think that I did understand your answer fully. And I saw this answer you hyperlinked before, but I was just wondering if I could get along without it. Thank you. – Denis Apr 27 '17 at 10:43
  • We didn't understand each other, unfortunately:( – Denis Apr 27 '17 at 13:17
0

You can implement the scroll view behaviour of TextView without using a ScrollView.

Set these in the xml for TextView

android:maxLines = "SOME_INTEGER"
android:scrollbars = "vertical"

And then use this in Java code:

yourTextView.setMovementMethod(new ScrollingMovementMethod());
schinj
  • 794
  • 4
  • 19
  • Oh, it actually works now, just needed to change layout_gravity to just gravity. Thank you very much. Only one thing is making me sad now: scrolling is not that smooth – Denis Apr 27 '17 at 10:49
  • @JaWrecker Okay Nice. If scrolling is not smooth with ScrollView, you can try to use my way. For me, scrolling is quite good. – schinj Apr 27 '17 at 10:54
  • Scrolling was smooth with ScrollView, but now I made changes and deleted ScrollView, then scrolling became not that smooth, I meant that :( – Denis Apr 27 '17 at 10:55