1

I'm having a trouble finding exactly what I'm looking for on the Internet for what I want to do. I have an EditText, and sometimes whatever the user inputs to the EditText will exceed the width of the field. I already have it setup so that it has HorizontallyScrolling so it doesn't push anything else out of place, but now I want to have my text scroll from left to right, and when it reaches the end of the text, it repeats.

If anyone has a solution to this I would be super excited to get that working. If anyone wants more clarification on what I want, I'd be happy to give it. Thanks all!

1 Answers1

1

Something like:

edittext.setScroller(new Scroller(myContext)); 
edittext.setMaxLines(1); 
edittext.setVerticalScrollBarEnabled(true); 
edittext.setMovementMethod(new ScrollingMovementMethod()); 

Update:

private final void focusOnView(){
        new Handler().post(new Runnable() {
            @Override
            public void run() {
                your_scrollview.scrollTo(0, your_EditBox.getBottom());
            }
        });
    }

Or for grabbing the keypress's:

public boolean onKey(View v, int keyCode, KeyEvent event) {
    switch (keyCode) {
        case KeyEvent.KEYCODE_ENTER:
         /* This is a sample for handling the Enter button */
      edittext.requestFocus();
      return true;
    }
    return false;
}

I looked at these threads:

Is there a way to programmatically scroll a scroll view to a specific edit text?

Catch keypress with android

Community
  • 1
  • 1
Petro
  • 3,484
  • 3
  • 32
  • 59
  • This is not really what I'm looking for. I want it to in a way act like a gif. I want one line, and as the text goes past the set width it just continues on that same line. I have that part already. The part I want is for the program to say "Oh hey, you have more text on this line, let me scroll the text to the left so you can see the rest of it", then once it reaches the end of the text, it goes back to the beginning and repeats.I honestly have no idea if what I'm asking for is possible, and if it's not then that's fine. – TheShinyGoombah Apr 08 '15 at 20:38