TextView显示的文字过长动态显示

要实现这样的效果需要在布局文件中加上:
android:singleLine=”true”
android:ellipsize=”marquee”
android:focusableInTouchMode=”true”
android:focusable=”true”

注意: android:layout_width必须设定长度。

<TextView
            android:id="@+id/name"
            android:layout_width="180dip"
            android:layout_height="wrap_content"
            android:focusableInTouchMode="true"
            android:layout_gravity="center_horizontal"
            android:textStyle="bold"
            android:textColor="#000000"
            android:singleLine="true"
            android:focusable="true"
            android:ellipsize="marquee"
            android:marqueeRepeatLimit="marquee_forever"
            android:layout_marginTop="90dip"
            android:textSize="18dip"
            android:text="@string/no_song">
        </TextView>

posted @ 2012-02-16 17:08  ymxk  阅读(293)  评论(0)    收藏  举报