安卓跑马灯效果产生停顿有关问题
安卓跑马灯效果产生停顿问题
<TextView
android:id="@+id/a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:textSize="18dip" />
private Handler handler = new Handler() {
public void handleMessage(android.os.Message msg) {
TextView tv=(TextView) findViewById(R.id.a);
tv.setText("abcdefghightlmnopqrstuvwsyzdffffffffffffff");
tv.setTextColor(getResources().getColor(R.color.red));
};
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
init();
}
private void init() {
handler.sendEmptyMessage(0);
}
效果是第二次循环时有停顿
------解决方案--------------------
android:targetSdkVersion版本多少啊!!!改成最高的试下
<TextView
android:id="@+id/a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:textSize="18dip" />
private Handler handler = new Handler() {
public void handleMessage(android.os.Message msg) {
TextView tv=(TextView) findViewById(R.id.a);
tv.setText("abcdefghightlmnopqrstuvwsyzdffffffffffffff");
tv.setTextColor(getResources().getColor(R.color.red));
};
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
init();
}
private void init() {
handler.sendEmptyMessage(0);
}
效果是第二次循环时有停顿
------解决方案--------------------
android:targetSdkVersion版本多少啊!!!改成最高的试下