【问题标题】:Android how to show an image for a specific time in a layout and then show the content of layoutAndroid如何在布局中显示特定时间的图像,然后显示布局的内容
【发布时间】:2020-01-16 18:37:01
【问题描述】:

我想知道如何显示一个图像,在我的例子中是一个 gif 加载屏幕,以便在打开 Web 视图的布局时显示,以便有时间在 Web 视图中加载内容。 我应该使用计时器来加载图像或其他任何东西。

new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            Intent i = new Intent(net_fragment_1.this,loadinganimate.class);
            startActivity(i);
            finish();
        }
    },1000);

我已经尝试过这段代码,但它崩溃了。 注意-我一直在同一个包中加载动画类。

但是当我保持在不同的包中并通过像 com.xyz.xyz.loadinganimate.class 这样的完整路径调用它时 它只是显示这个类而不是在一段时间后恢复到原来的窗口......

【问题讨论】:

    标签: android android-intent timer loading postdelayed


    【解决方案1】:

    删除处理程序并将这些行添加到您的代码中

    if (webView.isShown()){
                loadinganimate.setVisibility(View.INVISIBLE);
            }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-06-10
      • 1970-01-01
      • 1970-01-01
      • 2017-08-10
      • 1970-01-01
      • 2015-08-01
      • 1970-01-01
      相关资源
      最近更新 更多