0

For an app I'm creating, I have a few fields which can not be made bigger due to the limited space. For that reason, I would like the fields to scroll continuously. This is a bit like sometimes found in car radios where for example the RDS information scrolls. Is this possible using Android? I've already tried it using the Scroller and MovementMethod:

myEditText.setScroller(new Scroller(this)); 
myEditText.setMaxLines(1); 
myEditText.setHorizontalScrollBarEnabled(true);
myEditText.setMovementMethod(new ScrollingMovementMethod()); 

However, this doesn't do what I want it to do. This is my EditText:

<EditText
 android:id="@+id/pedigreeLineAEditText"
 android:layout_width="match_parent"
 android:layout_height="@dimen/line_height"
 android:clickable="false"
 android:cursorVisible="false"
 android:focusable="false"
 android:focusableInTouchMode="false"
 android:inputType="none"
 android:singleLine="true"
 android:textSize="@dimen/text_size" />
koesie10
  • 572
  • 4
  • 17
  • 1
    By scrolling you mean animation which moves from left to right... RIGHT?? Then, check out [this link](http://stackoverflow.com/a/16371310/2345913) , this will help – CRUSADER Jul 30 '13 at 10:45
  • @CRUSADER thank you, that works. Now I only have to modify the code to not scroll over the whole screen, but only over a part, but I think I will succeed in that. – koesie10 Jul 30 '13 at 11:04
  • Check this question also http://stackoverflow.com/questions/3332924/textview-marquee-not-working – Jibin Scaria Jul 30 '13 at 11:18
  • Check my answer http://stackoverflow.com/questions/3332924/textview-marquee-not-working/13246560#13246560 – Kirit Vaghela Jul 30 '13 at 11:23

1 Answers1

0

Does it need to be an EditText? if not you can try something like this

  <TextView
android:text="START | lunch 20.00 | Dinner 60.00 | Travel 60.00 | Doctor 5000.00 | lunch 20.00 | Dinner 60.00 | Travel 60.00 | Doctor 5000.00 | END"
android:id="@+id/MarqueeText" 
android:layout_width="fill_parent"
android:layout_height="wrap_content" 
android:singleLine="true"
android:ellipsize="marquee" 
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true" 
android:paddingLeft="15dip" 
android:paddingRight="15dip" 
android:focusable="true" 
android:focusableInTouchMode="true" 
android:freezesText="true">

I don't think this will work with an Edit text in the same way but maybe this will work for you. This Code was from another answer that can be seen here

TextView Marquee not working

Community
  • 1
  • 1
KBusc
  • 663
  • 8
  • 24