textView自动滑动
今天一个功能需要用到textview滑动效果,在网上找了几个例子
整理一下,以备后用
<TextView
android:id="@+id/textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
android:text=""
android:textColor="@android:color/black" />
还需要在java类中添加一行
TextView textview = (TextView) findViewById(R.id.textview);
textview.setMovementMethod(ScrollingMovementMethod.getInstance());