Android TextView滚动效果

来源:互联网 发布:名望模型淘宝 编辑:程序博客网 时间:2024/04/29 16:12

觉得字符串可能长短不一,不能完全显示,老大说让做成滚动效果那种,本来以为很难,不过万能的baidu告诉我不难,如下而已:
TextView加三行属性

android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"

ps:下面这个layout我验证过,可以滚动的

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView        android:text="123456789qwertyuiopasdghhj123456789qwertyuiopasdghhj"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:focusable="true"/>       
</LinearLayout>

原创粉丝点击