RaiflatDelegate.java 文件源码

java
阅读 79 收藏 0 点赞 0 评论 0

项目:RaiflatButton 作者:
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void setupStateListAnimator() {
    mFlatStateListAnimator = new StateListAnimator();

    ObjectAnimator pressed = ObjectAnimator.ofFloat(this, "elevation", 0)
            .setDuration(mView.getContext().getResources()
                    .getInteger(android.R.integer.config_shortAnimTime));

    ObjectAnimator notPressed = ObjectAnimator.ofFloat(this, "elevation", mView.getElevation()
            + mView.getTranslationZ()).setDuration(mView.getContext().getResources()
            .getInteger(android.R.integer.config_shortAnimTime));


    notPressed.setStartDelay(100);

    mFlatStateListAnimator.addState(new int[]{android.R.attr.state_pressed,
            android.R.attr.state_enabled}, pressed);

    mFlatStateListAnimator.addState(new int[]{android.R.attr.state_enabled}, notPressed);

    mFlatStateListAnimator.addState(new int[]{},
            ObjectAnimator.ofFloat(this, "elevation", 0).setDuration(0));

    mView.setStateListAnimator(mFlatStateListAnimator);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号