实现电视主界面突出放大的选中效果

注意事项

1.如果一个布局中有个Button ImageButton, 很可能被抢夺焦点,导致onFocusChanged不能被执行!!

2.setNextFocusRightId 暂时需要Programly设置, 在xml中设置没有效果.

3.Animator动画的使用:

 private void zoomIn() {
        //缩小动画
        if (mAnimatorSetZoomIn == null) {
            mAnimatorSetZoomIn = new AnimatorSet();
            ObjectAnimator animatorX = ObjectAnimator.ofFloat(this, "scaleX", 1.2f, 1.0f);
            ObjectAnimator animatorY = ObjectAnimator.ofFloat(this, "scaleY", 1.2f, 1.0f);
            animatorX.setDuration(300);
            animatorY.setDuration(300);
            mAnimatorSetZoomIn.playTogether(animatorX, animatorY);
        }
        mAnimatorSetZoomIn.start();
    }
    
    private void zoomOut() {
        //放大动画
        if (mAnimatorSetZoomOut == null) {
            mAnimatorSetZoomOut = new AnimatorSet();
            ObjectAnimator animatorX = ObjectAnimator.ofFloat(this, "scaleX", 1.0f, 1.2f);
            ObjectAnimator animatorY = ObjectAnimator.ofFloat(this, "scaleY", 1.0f, 1.2f);
            animatorX.setDuration(300);
            animatorY.setDuration(300);
            mAnimatorSetZoomOut.playTogether(animatorX, animatorY);
        }
        mAnimatorSetZoomOut.start();
    }



地址  https://github.com/sfshine/TVSelectorZoomView

实现电视主界面突出放大的选中效果_第1张图片


你可能感兴趣的:(实现电视主界面突出放大的选中效果)