SegmentController.java 文件源码

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

项目:PDialogs-Android 作者:
private void adjustSizes(boolean isAnimated) {
    int width = getWidth();
    if (width > 0 && this.items != null) {
        LayoutParams viewLayoutParams = (LayoutParams) this.currentView.getLayoutParams();
        viewLayoutParams.width = width / this.items.length;
        this.currentView.setLayoutParams(viewLayoutParams);
        if (!this.inAnimation) {
            if (isAnimated) {
                this.inAnimation = true;
                TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0,
                        Animation.RELATIVE_TO_SELF, this.currentIndex - this.lastIndex, 0, 0, 0, 0);
                animation.setDuration(300);
                animation.setAnimationListener(this);
                this.currentView.startAnimation(animation);
                return;
            }
            viewLayoutParams.leftMargin = this.currentIndex * viewLayoutParams.width;
            this.currentView.setLayoutParams(viewLayoutParams);
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号