ParallaxLayerLayout.java 文件源码

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

项目:CheckIn 作者:
public void updateTranslations(@Size(2) float[] translations) {
    if (Math.abs(translations[0]) > 1 || Math.abs(translations[1]) > 1) {
        throw new IllegalArgumentException("Translation values must be between 1.0 and -1.0");
    }

    final int childCount = getChildCount();
    for (int i = childCount - 1; i >= 0; i--) {
        View child = getChildAt(i);
        float[] translationsPx = calculateFinalTranslationPx(child, translations);
        child.setTranslationX(translationsPx[0]);
        child.setTranslationY(translationsPx[1]);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号