Android Auto Scrolling EditText Hint -
problem making edittext scrollable
there mentioned not scrollable singleline=true.
so have 2 options:
i check if user inputs "\n" , delete that, have worry things in second line, too.
-
i use custom textviews scrolls through in loop, used here hint ?
<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 extends 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; }
}
i cant formated right. sorry that.
make edittext scrollable this:
edittext youredittext = new edittext(context); youredittext.setscroller(new scroller(context)); youredittext.setmaxlines(1); youredittext.setverticalscrollbarenabled(true); youredittext.setmovementmethod(new scrollingmovementmethod());
Comments
Post a Comment