当前位置: 首页>>代码示例>>Java>>正文


Java CircleImageView.setLayoutParams方法代码示例

本文整理汇总了Java中de.hdodenhof.circleimageview.CircleImageView.setLayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java CircleImageView.setLayoutParams方法的具体用法?Java CircleImageView.setLayoutParams怎么用?Java CircleImageView.setLayoutParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在de.hdodenhof.circleimageview.CircleImageView的用法示例。


在下文中一共展示了CircleImageView.setLayoutParams方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDependentViewChanged

import de.hdodenhof.circleimageview.CircleImageView; //导入方法依赖的package包/类
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, CircleImageView child, View dependency) {

    // 初始化属性
    shouldInitProperties(child, dependency);

    // 最大滑动距离: 起始位置-状态栏高度
    final int maxScrollDistance = (int) (mStartToolbarPosition - getStatusBarHeight());

    // 滑动的百分比
    float expandedPercentageFactor = dependency.getY() / maxScrollDistance;

    // Y轴距离
    float distanceYToSubtract =  - ((mStartYPosition - mFinalYPosition)
            * (1f - expandedPercentageFactor)) + (child.getHeight() * 3 / 4);

    // 高度减小
    float heightToSubtract =  ((mStartHeight - mFinalHeight) * (1f - expandedPercentageFactor));

    // 图片位置
    child.setY(mStartYPosition - distanceYToSubtract);

    // 图片大小
    CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) child.getLayoutParams();
    lp.width = (int) (mStartHeight - heightToSubtract);
    lp.height = (int) (mStartHeight - heightToSubtract);
    child.setLayoutParams(lp);

    return true;
}
 
开发者ID:yuhodev,项目名称:login,代码行数:31,代码来源:AvatarImageBehavior.java

示例2: onDependentViewChanged

import de.hdodenhof.circleimageview.CircleImageView; //导入方法依赖的package包/类
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, CircleImageView child, View dependency) {

    // 初始化属性
    shouldInitProperties(child, dependency);

    // 最大滑动距离: 起始位置-状态栏高度
    final int maxScrollDistance = (int) (mStartToolbarPosition - getStatusBarHeight());

    // 滑动的百分比
    float expandedPercentageFactor = dependency.getY() / maxScrollDistance;

    // Y轴距离
    float distanceYToSubtract = ((mStartYPosition - mFinalYPosition)
            * (1f - expandedPercentageFactor)) + (child.getHeight() / 2);

    // X轴距离
    float distanceXToSubtract = ((mStartXPosition - mFinalXPosition)
            * (1f - expandedPercentageFactor)) + (child.getWidth() / 2);

    // 高度减小
    float heightToSubtract = ((mStartHeight - mFinalHeight) * (1f - expandedPercentageFactor));

    // 图片位置
    child.setY(mStartYPosition - distanceYToSubtract);
    child.setX(mStartXPosition - distanceXToSubtract);

    // 图片大小
    CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) child.getLayoutParams();
    lp.width = (int) (mStartHeight - heightToSubtract);
    lp.height = (int) (mStartHeight - heightToSubtract);
    child.setLayoutParams(lp);

    return true;
}
 
开发者ID:ximsfei,项目名称:Android-skin-support,代码行数:36,代码来源:AvatarImageBehavior.java


注:本文中的de.hdodenhof.circleimageview.CircleImageView.setLayoutParams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。