Android Auto Scrolling EditText Hinweis

Problem damit, Edittext scrollbar zu machen

es wird erwähnt, dass es mit singleLine = true nicht scrollbar ist.

Also habe ich 2 Möglichkeiten:

Ich überprüfe, ob der Benutzer "\ n" eingibt und lösche, dann muss ich mich auch um die Dinge in der zweiten Zeile kümmern.

Ich verwende eine benutzerdefinierte Textansicht, die in einer Schleife durchläuft. Kann diese auch hier nur für den Hinweis verwendet werden?

 <com.test.ScrollingTextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_marginTop="1dp"
        android:layout_weight="0.17"
        android:background="@color/black"
        android:ellipsize="marquee"
        android:gravity="center_vertical"
        android:marqueeRepeatLimit="marquee_forever"
        android:paddingLeft="10dp"
        android:scrollHorizontally="true"
        android:singleLine="true"
        android:text="@string/editLength"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="@color/white" />

public class ScrollingTextView erweitert TextView {

public ScrollingTextView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
}

public ScrollingTextView(Context context, AttributeSet attrs) {
    super(context, attrs);
}

public ScrollingTextView(Context context) {
    super(context);
}

@Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
    if (focused)
        super.onFocusChanged(focused, direction, previouslyFocusedRect);
}

@Override
public void onWindowFocusChanged(boolean focused) {
    if (focused)
        super.onWindowFocusChanged(focused);
}

@Override
public boolean isFocused() {
    return true;
}

}

Ich kann es einfach nicht richtig formatieren. Das tut mir leid.

Antworten auf die Frage(1)

Ihre Antwort auf die Frage