penfeizhou / APNG4Android

Android animation support for APNG & Animated WebP & Gif & Animated AVIF, High performance
Apache License 2.0
570 stars 75 forks source link

Seekbar 的 thumb 中无法使用 #190

Closed CatoGodlee closed 1 year ago

CatoGodlee commented 1 year ago

你好,这个库非常好用,感谢作者。

在最近的使用中有一个需要在 Seekbar 中使用动画的需求,代码实现如下:

val apngDrawable = APNGDrawable.fromResource(this, R.raw.test)
binding.sbGeneratingProgress.thumb = apngDrawable
apngDrawable.callback = binding.sbGeneratingProgress
apngDrawable.setAutoPlay(true)

发现并没有任何显示,请问一下这种怎么处理,现有的方式支持吗?

jingpeng commented 1 year ago

我测试了下,即使设置给Thumb,依然可以进行动画播放,具体代码如下:

` package com.github.penfeizhou.animation.demo;

import android.os.Bundle; import android.widget.SeekBar;

import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity;

import com.github.penfeizhou.animation.apng.APNGDrawable;

public class ThumbTestActivity extends AppCompatActivity {

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_thumb_test);

    APNGDrawable apngDrawable = APNGDrawable.fromAsset(this, "test5.png");

    SeekBar seekBar = findViewById(R.id.seek_bar);
    seekBar.setThumb(apngDrawable);

    apngDrawable.start();
}

} `

jingpeng commented 1 year ago

https://github.com/penfeizhou/APNG4Android/assets/5223226/d86ddcd8-53e1-42d5-a0a7-8e61d4021b3d

CatoGodlee commented 1 year ago

我看看有什么问题,再回复

Sunnyoung commented 10 months ago

device-2023-07-07-115553.mp4

视频里的thumb不会跟随进度移动