我需要逐帧创建动画,但是遇到了一些问题。我有30个png图像组成我的动画,我使用以下代码加载我的AnimationDrawable:
mCurrentAnimation = new AnimationDrawable();
mCurrentAnimation.setOneShot(true);
int resId;
for (int j = 1; j < 31; j++)
{
resId = getResources().getIdentifier("resName", "drawable", "com.mindcolorstest.main");
mCurrentAnimation.addFrame(getResources().getDrawable(resId), 1);
}
逻辑上,“mCurrentAnimation.start()”是启动动画的命令。 在mdpi设备上,动画可以正常运行,但我在hdpi模拟器或设备上遇到了一些问题,每帧持续时间有点长。如果我减少每帧的持续时间(无论是在mdpi还是hdpi设备上),动画速度并不会变快,似乎每帧都存在最小持续时间。 你有什么技巧和建议吗? 我不知道应该怎么做Q_Q 无论如何感谢您的帮助