首页 > 解决方案 > 按时间相关显示对象

问题描述

如何进行如下图所示的活动?我尝试使用倒数计时器,但我无法成功,因为一个在时间用完之前触发了另一个。

谢谢你。

在此处输入图像描述

我的代码

    private void Test(final ArrayList<String> obj, final ArrayList<Integer> Times, final ArrayList<String> ObjectType) {
    for (int i = 0; i < obj.size(); i++) {
        final Integer ShowTime = Times.get(i);
        final String OName = obj.get(i);
        final String OType = ObjectType.get(i);
        //Show time is numerical variable


        if (OType.equals("Image")) {
            final ImageView Resim = (ImageView) findViewById(R.id.container).findViewWithTag(OName);


            new CountDownTimer(ShowTime, ShowTime) {


                public void onTick(long millisUntilFinished) {


                    Resim.setVisibility(View.VISIBLE);


                }

                public void onFinish() {

                    Resim.setVisibility(View.VISIBLE);


                }

            }.start();
        } else if (OType.equals("Buton")) {
......
        }

    }

}

标签: javaandroidobjecttimershow

解决方案


推荐阅读