我希望horizontalscrollview从开始或从右到左重复方向重复。我们怎样才能做到这一点。我使用Handler对象进行自动滚动。
android.widget.HorizontalScrollView horizontalScrollView1;
Handler mHandler = new Handler(new Callback() {
@Override
public boolean handleMessage(Message msg) {
horizontalScrollView1.smoothScrollBy(1, 0);
mHandler.sendMessageDelayed(new Message(), 20);
return false;
}
});
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.horizontal_scroll_view);
horizontalScrollView1= (android.widget.HorizontalScrollView) findViewById(R.id.horizontalScrollView1);
mHandler.sendMessageDelayed(new Message(), 1000);
}