在Android工具栏中添加动画可绘制为徽标
是否可以在工具栏中添加一个可以设置动画的图标?我有一个动画列表xml,我想用它作为我的工具栏中的图标,而不是一个普通的可绘制的在Android工具栏中添加动画可绘制为徽标,android,android-toolbar,Android,Android Toolbar,是否可以在工具栏中添加一个可以设置动画的图标?我有一个动画列表xml,我想用它作为我的工具栏中的图标,而不是一个普通的可绘制的 Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); toolbar.setLogo(R.drawable.animated_icon); getSupportActionBar().setDisplayHomeAsUpE
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setLogo(R.drawable.animated_icon);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mActionBar = getSupportActionBar();
mActionBar.setDisplayShowHomeEnabled(true);
mActionBar.setHomeButtonEnabled(true);
我的提款权:
<animation-list android:oneshot="true"
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:duration="250" android:drawable="@drawable/first_case" />
<item android:duration="250" android:drawable="@drawable/second_case" />
<item android:duration="250" android:drawable="@drawable/third_case" />
</animation-list>
我试过使用toolbar.setNavigationIcon(R.drawable.animated_图标)代码>
但这一点都不活跃。这是不是走错了路?谢谢。您还需要用java启动动画吗?我添加了:toolbar.animate();但一切都没有改变。我的问题有那么糟糕以至于我投了反对票吗?如果它不重要,我就删除它,不需要制作“无用”的内容。你还需要用java启动动画吗?我添加了:toolbar.animate();但一切都没有改变。我的问题有那么糟糕以至于我投了反对票吗?如果它是不重要的,我将删除它,没有必要使“无用”的内容。