バックグラウンド
アクションバーの背景を変更したり、2 つの色の間でアニメーション化することも可能です。
public static void animateBetweenColors(final ActionBar actionBar, final int colorFrom, final int colorTo,
final int durationInMs) {
final ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
colorAnimation.addUpdateListener(new AnimatorUpdateListener() {
ColorDrawable colorDrawable = new ColorDrawable(colorFrom);
@Override
public void onAnimationUpdate(final ValueAnimator animator) {
colorDrawable.setColor((Integer) animator.getAnimatedValue());
actionBar.setBackgroundDrawable(colorDrawable);
}
});
if (durationInMs >= 0)
colorAnimation.setDuration(durationInMs);
colorAnimation.start();
}
問題
アクションモードのビューを取得する方法が見つからないため、場合によっては (表示中に) 背景を変更できます。
私が試したこと
私が見つけた唯一のものは、アクションモードのIDが同じままであると仮定するハック的な方法であり、これでも「完了」ボタン(「V」のように見えるボタン)のビューに対してのみ機能します実際には「キャンセル」に似ています)。
テーマを介して変更する方法も見つけましたが、プログラムで行う必要があるため、それは必要ありません。
質問
actionMode のビューを取得するにはどうすればよいですか? より正確には、アニメーションを使用して背景を変更するにはどうすればよいですか?