Android 动作栏中的菜单项Sherlock每次搜索都会变暗
我使用以下代码向菜单添加了一个刷新按钮Android 动作栏中的菜单项Sherlock每次搜索都会变暗,android,animation,actionbarsherlock,menuitem,Android,Animation,Actionbarsherlock,Menuitem,我使用以下代码向菜单添加了一个刷新按钮 refreshItem = menu.add(Menu.NONE, REFRESH_ITEM_ID, 1, getString(R.string.refresh)); refreshItem.setIcon(getResources().getDrawable(R.drawable.ic_action_refresh)); refreshItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); void
refreshItem = menu.add(Menu.NONE, REFRESH_ITEM_ID, 1, getString(R.string.refresh));
refreshItem.setIcon(getResources().getDrawable(R.drawable.ic_action_refresh));
refreshItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
void setupAnimation() {
RotateAnimation.RELATIVE_TO_SELF, 0.36f,
RotateAnimation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setDuration(800);
rotateAnimation.setRepeatCount(Animation.INFINITE);
refreshItem.setActionView(R.layout.ic_action_bar_refresh_layout);
animatedIcon = (ImageView) refreshItem.getActionView();
...
}
///
///
public void startRefreshingAnimation() {
animatedIcon.startAnimation(rotateAnimation);
}
当应用程序启动时,这是刷新图标的颜色
如果刷新处于活动状态,即已设置动画(使用以下代码)
然后,每次点击搜索图标时,它会逐渐变暗。
请注意,只有当图标被设置动画时,图标才会变暗。Meybe这是我的显示器,但您发布的图片中的所有颜色略有不同。现在我看起来更像是UI的其他部分变得更轻了。您是否尝试在动画完成后重置条形图或图像?无法重置,因为在动画过程中图标会变暗。但我做了一些稍微不同的事情,成功了,我暂停了动画(使用自定义代码),并在几毫秒后发送了一份恢复,成功了:)