本文整理匯總了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;
}