Android TextView走马灯效果
布局:
<TextView android:id="@+id/myTextView" android:layout_width="match_parent" android:layout_height="wrap_content" android:ellipsize="marquee" android:marqueeRepeatLimit="marquee_forever" android:scrollHorizontally="true" android:singleLine="true" android:text="hello world my dear friend this is a long long string~~~~hello world my dear friend this is a long long string" />
还需要在程序中进行控制:
TextView mTextView = (TextView) findViewById(R.id.myTextView); // 开始走马灯效果 mTextView.setSelected(true); // 停止走马灯效果 // mTextView.setSelected(false);