Android Lollipop Menu Button to Back Button

If you see the application Google Play

, while scrolling through the menu, menu button

convert yourself to back button

your finger gradually and beautifully, it doesn't seem like animation. can anyone help me achieve this goal? Feel free to move / close the post, but please be kind to redirect me in any useful direction.

enter image description hereenter image description hereenter image description hereenter image description here

+3


source to share


1 answer


Icon transitions can be implemented using AnimatedStateListDrawable (Theres also support animated vector icons.)

eg.



 public void setOrAnimatePlusCheckIcon(final ImageView imageView, boolean isCheck,
                                      boolean allowAnimate) {
    if (!hasL()) {
        compatSetOrAnimatePlusCheckIcon(imageView, isCheck, allowAnimate);
        return;
    }

    Drawable drawable = imageView.getDrawable();
    if (!(drawable instanceof AnimatedStateListDrawable)) {
        drawable = mActivity.getResources().getDrawable(R.drawable.add_schedule_fab_icon_anim);
        imageView.setImageDrawable(drawable);
    }
    imageView.setColorFilter(isCheck ?
            mActivity.getResources().getColor(R.color.theme_accent_1) : Color.WHITE);
    if (allowAnimate) {
        imageView.setImageState(isCheck ? STATE_UNCHECKED : STATE_CHECKED, false);
        drawable.jumpToCurrentState();
        imageView.setImageState(isCheck ? STATE_CHECKED : STATE_UNCHECKED, false);
    } else {
        imageView.setImageState(isCheck ? STATE_CHECKED : STATE_UNCHECKED, false);
        drawable.jumpToCurrentState();
    }
}

      

code https://github.com/google/iosched

0


source







All Articles