代码之家  ›  专栏  ›  技术社区  ›  OneWorld

在Android中使用本机旋转器

  •  0
  • OneWorld  · 技术社区  · 15 年前

    我想重建 nativ android progress indicator 并将其显示为列表项的图标。我跟随 this example 最后是一个重性能的吃动画,这也不符合本地旋转器。代码具有“linerinterpolator”,这似乎导致了这些问题。

    现在我做了自己的国际刑警组织,满足了我的一个需求:它将步骤量化为12个。

    但是,我仍然有巨大的性能问题。 uithread现在不允许我的后台线程运行 ,用于下载和分析数据。请注意,我正在列表中显示几个微调器。我还尝试在listadapter中将插值器设置为类变量。所以,所有列表视图都可以使用这个插值器。

    if(imageViewIcon != null) {
      RotateAnimation anim = new RotateAnimation(0f, 360f, 51f, 51f);
      anim.setInterpolator(new Interpolator() {
    
        @Override
        public float getInterpolation( float input ) {
          return (float) Math.floor((double)input*10)/12;
        }
      });
     // anim
      anim.setRepeatCount(Animation.INFINITE);
      anim.setDuration(1000);
    
    
      // Start animating the image
      imageViewSpinner.startAnimation(anim);
    
    
    }
    

    更新

    最后,我发现了ProgressBarWidget,它和我做的完全一样。不过,它的性能还是不太好。(不过更好)

    1 回复  |  直到 15 年前
        1
  •  3
  •   OneWorld    15 年前

    使用小部件” ProgressBar “。最简单的版本是圆形旋转器

    推荐文章