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