私が作成している動的テキストビューに添付された単純なアニメーションがありますが、追加中に遅延を追加したいのです。その方法を教えてください。
LinearLayout ll = (LinearLayout)findViewById(R.id.ll);
final HorizontalScrollView hsv = new HorizontalScrollView(TestViewActivity.this);
LinearLayout lhsv = new LinearLayout(TestViewActivity.this);
Animation a1 = new AlphaAnimation(0.00f, 1.00f);
a1.setDuration(350);
a1.setFillAfter(true);
for(int k =0; k < 5; k++){
// may be some handler here but how ?
TextView tv = new TextView(TestViewActivity.this);
tv.setText("Text");
tv.setTextSize(42);
tv.setPadding(10, 0, 10, 0);
tv.setVisibility(View.INVISIBLE);
tv.clearAnimation();
tv.startAnimation(a1);
lhsv.addView(tv, k);
}
hsv.addView(lhsv);
ll.addView(hsv);
ありがとう
提案に基づいて、私はこれを試してみましたが、すべてのビューが一緒に来ます.
final Handler handler = new Handler();
LinearLayout ll = (LinearLayout)findViewById(R.id.ll);
final HorizontalScrollView hsv = new HorizontalScrollView(TestViewActivity.this);
final LinearLayout lhsv = new LinearLayout(TestViewActivity.this);
final Animation a1 = new AlphaAnimation(0.00f, 1.00f);
a1.setDuration(350);
a1.setFillAfter(true);
for(int k =0; k < 5; k++){
new Handler().postDelayed(new Runnable() {
public void run() {
//write your code here...
final TextView tv = new TextView(TestViewActivity.this);
tv.setText("Text");
tv.setTextSize(42);
tv.setPadding(10, 0, 10, 0);
tv.setVisibility(View.INVISIBLE);
tv.clearAnimation();
tv.startAnimation(a1);
lhsv.addView(tv, temp);
temp++;
}
}, 2000);
}
hsv.addView(lhsv);
ll.addView(hsv);