本文整理汇总了Java中de.hdodenhof.circleimageview.CircleImageView.getWidth方法的典型用法代码示例。如果您正苦于以下问题:Java CircleImageView.getWidth方法的具体用法?Java CircleImageView.getWidth怎么用?Java CircleImageView.getWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.hdodenhof.circleimageview.CircleImageView
的用法示例。
在下文中一共展示了CircleImageView.getWidth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: maybeInitProperties
import de.hdodenhof.circleimageview.CircleImageView; //导入方法依赖的package包/类
private void maybeInitProperties(CircleImageView child, View dependency) {
if (mStartYPosition == 0)
mStartYPosition = (int) (dependency.getY());
if (mFinalYPosition == 0)
mFinalYPosition = (dependency.getHeight() /2);
if (mStartHeight == 0)
mStartHeight = child.getHeight();
if (mStartXPosition == 0)
mStartXPosition = (int) (child.getX() + (child.getWidth() / 2));
if (mFinalXPosition == 0)
mFinalXPosition = mContext.getResources().getDimensionPixelOffset(R.dimen.abc_action_bar_content_inset_material) + ((int) mCustomFinalHeight / 2);
if (mStartToolbarPosition == 0)
mStartToolbarPosition = dependency.getY();
if (mChangeBehaviorPoint == 0) {
mChangeBehaviorPoint = (child.getHeight() - mCustomFinalHeight) / (2f * (mStartYPosition - mFinalYPosition));
}
}
示例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;
}
示例3: shouldInitProperties
import de.hdodenhof.circleimageview.CircleImageView; //导入方法依赖的package包/类
/**
* 初始化动画值
*
* @param child 图片控件
* @param dependency ToolBar
*/
private void shouldInitProperties(CircleImageView child, View dependency) {
// 图片控件中心
if (mStartYPosition == 0)
mStartYPosition = (int) (child.getY() + (child.getHeight() / 2));
// Toolbar中心
if (mFinalYPosition == 0)
mFinalYPosition = (dependency.getHeight() / 2);
// 图片高度
if (mStartHeight == 0)
mStartHeight = child.getHeight();
// Toolbar缩略图高度
if (mFinalHeight == 0)
mFinalHeight = mContext.getResources().getDimensionPixelOffset(R.dimen.image_final_width);
// 图片控件水平中心
if (mStartXPosition == 0)
mStartXPosition = (int) (child.getX() + (child.getWidth() / 2));
// 边缘+缩略图宽度的一半
if (mFinalXPosition == 0)
mFinalXPosition = mContext.getResources().getDimensionPixelOffset(R.dimen.abc_action_bar_content_inset_material) + (mFinalHeight / 2);
// Toolbar的起始位置
if (mStartToolbarPosition == 0)
mStartToolbarPosition = dependency.getY() + (dependency.getHeight() / 2);
}