本文整理汇总了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;
}
示例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;
}