animationDrawable不是在动作条打? [英] animationDrawable is not playing in Actionbar?

查看:118
本文介绍了animationDrawable不是在动作条打?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的开发者指南( http://developer.android .COM /引导/主题/图形/绘制-animation.html )来创建一个动画记录按钮,使小的改动器。---一个动作条菜单项,而不是一个ImageView的。当我打电话在onStart不能播放?

I am using the developer guide(http://developer.android.com/guide/topics/graphics/drawable-animation.html) to create a animating record button, Making minor changes to accomadate an actionbar menuitem instead of an imageView. When I call the onStart it does not play?

下面是一个使用code IM

Here is the code im using

                    RecordButton.setIcon(R.drawable.recordbutton);
        recordAnimation = (AnimationDrawable) RecordButton.getIcon();
        recordAnimation.start()

有谁知道为什么它不玩?

Does anyone know why its not playing?

推荐答案

我有同样的问题。我是能够通过使用一个操作栏提供商绕过它,如下所述: http://developer.android.com/guide/topics/ui/actionbar.html#ActionProvider

I had the same problem. I was able to get around it by using an action bar provider as described here: http://developer.android.com/guide/topics/ui/actionbar.html#ActionProvider

跳过ShareActionProvider并创建一个自定义的。这使您可以使用自定义布局的动作栏项目(在这种情况下,ImageView的),如您的链接描述了可绘制动画指南,你可以操纵。

Skip the ShareActionProvider and create a custom one. This lets you use a custom layout for your action bar item (an ImageView in this case) that you can manipulate as described in your link to the Drawable Animation guide.

这篇关于animationDrawable不是在动作条打?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆