您的位置:首页 > 其它

textview跑马灯和水平滚动条

2015-07-28 17:28 218 查看
跑马灯如下:

<TextView

android:layout_width="100px"

android:layout_height="wrap_content"

android:text="234254fadfadffadfadfgfhdgfhjhfjhfjhjfhjfhjfhjfhjtyteytryet"

android:marqueeRepeatLimit="marquee_forever"

android:ellipsize="marquee"

android:scrollHorizontally="true"

android:focusableInTouchMode="true"

android:focusable="true"></TextView>

要显示该跑马灯,view必须要获得焦点,只有在取得焦点的情况下跑马灯才会显示


水平滚动条:

一、Xml代码

<TextView

android:id="@+id/textview"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:singleLine="false"

android:maxLines="5"

android:scrollbars="vertical"

/>

二、还需要在代码中设置 TextView 相应的方法

TextView textView = (TextView)findViewById(R.id.text_view);

textView.setMovementMethod(ScrollingMovementMethod.getInstance());
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: