【问题标题】:Take use of the native spinner in Android在 Android 中使用本机微调器
【发布时间】:2010-10-25 04:31:34
【问题描述】:

我想重建(也许我什至不必)nativ android progress indicator 并将其显示为列表项的图标。我关注this example 并完成了一个沉重的表演吃动画,这也与原生微调器不匹配。该代码具有“LinearInterpolator”,这似乎会导致这些问题。

现在我制作了自己的 Interpolar 并满足了我的一个需求:它将步骤量化为 12 个。

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

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。但是,它仍然不是很高效。 (虽然更好)

【问题讨论】:

    标签: android android-widget rotation spinner android-animation


    【解决方案1】:

    使用小部件“ProgressBar”。最简单的版本是那个圆形微调器

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-20
      • 2011-08-24
      • 1970-01-01
      • 2021-10-05
      • 2012-11-11
      • 2011-10-18
      • 1970-01-01
      • 2022-01-25
      相关资源
      最近更新 更多