本文整理匯總了Java中android.graphics.PointF.offset方法的典型用法代碼示例。如果您正苦於以下問題:Java PointF.offset方法的具體用法?Java PointF.offset怎麽用?Java PointF.offset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.graphics.PointF
的用法示例。
在下文中一共展示了PointF.offset方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: offset
import android.graphics.PointF; //導入方法依賴的package包/類
public void offset(
float x,
float y)
{
PointF pt = new PointF(mCenter.x, mCenter.y);
pt.offset(x, y);
setCenter(pt.x, pt.y);
}
示例2: onLayout
import android.graphics.PointF; //導入方法依賴的package包/類
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
mScrimView.layout(0, 0, getMeasuredWidth(), getMeasuredHeight());
mIndicatorView.layout(mCenterPoint.x - (int) (mIndicatorView.getMeasuredWidth() / 2.0),
mCenterPoint.y - (int) (mIndicatorView.getMeasuredHeight() / 2.0),
mCenterPoint.x + (int) (mIndicatorView.getMeasuredWidth() / 2.0),
mCenterPoint.y + (int) (mIndicatorView.getMeasuredHeight() / 2.0));
int index = 0;
for (Map.Entry<Action, ActionView> entry : mActionViews.entrySet()) {
float startAngle = getOptimalStartAngle(entry.getValue().getActionCircleRadiusExpanded());
ActionView actionView = entry.getValue();
PointF point = getActionPoint(index, startAngle, actionView);
point.offset(-actionView.getCircleCenterX(), -actionView.getCircleCenterY());
actionView.layout((int) point.x, (int) point.y, (int) (point.x + actionView.getMeasuredWidth()), (int) (point.y + actionView.getMeasuredHeight()));
ActionTitleView titleView = mActionTitleViews.get(entry.getKey());
if (titleView != null) {
float titleLeft = point.x + (actionView.getMeasuredWidth() / 2) - (titleView.getMeasuredWidth() / 2);
float titleTop = point.y - 10 - titleView.getMeasuredHeight();
titleView.layout((int) titleLeft, (int) titleTop, (int) (titleLeft + titleView.getMeasuredWidth()), (int) (titleTop + titleView.getMeasuredHeight()));
}
index++;
}
if (!mAnimated) {
animateActionsIn();
animateIndicatorIn();
animateScrimIn();
mAnimated = true;
}
}
示例3: createFieldGeometry
import android.graphics.PointF; //導入方法依賴的package包/類
private void createFieldGeometry(Field f, float startAngle, float sweepAngle) {
startAngle = mod(startAngle, 360);
int rot = startAngle < 120 ? 0 : startAngle < 240 ? 1 : 2;
startAngle = mod(startAngle, 120);
float R = mRadius - mPadding;
float p = mPadding;
PointF p_i1 = calcInnerPoint(R, p, startAngle, true);
PointF p_i2 = calcInnerPoint(R, p, startAngle + sweepAngle, false);
float aAd = (float) Math.toDegrees(Math.asin(p/2/R));
float alpha_1 = startAngle + aAd;
float alpha_2 = startAngle + sweepAngle - aAd;
// PointF p_a1 = new PointF(R*(float)Math.cos(Math.toRadians(alpha_1)), R*(float)Math.sin(Math.toRadians(alpha_1)));
// PointF p_a2 = new PointF(R*(float)Math.cos(Math.toRadians(alpha_2)), R*(float)Math.sin(Math.toRadians(alpha_2)));
p_i1.offset(mCenter.x, mCenter.y);
p_i2.offset(mCenter.x, mCenter.y);
// p_a1.offset(mCenter.x, mCenter.y);
// p_a2.offset(mCenter.x, mCenter.y);
RectF oval = new RectF(mCenter.x - R, mCenter.y - R, mCenter.x + R, mCenter.y + R);
//f.points = new PointF[]{p_i1, p_a1, p_a2, p_i2};
f.rawPath = new Path();
f.rawPath.moveTo(p_i1.x, p_i1.y);
// f.path.lineTo(p_a1.x, p_a1.y);
// f.path.lineTo(p_a2.x, p_a2.y);
f.rawPath.arcTo(oval, alpha_1, alpha_2-alpha_1);
f.rawPath.lineTo(p_i2.x, p_i2.y);
f.rawPath.close();
Matrix mMatrix = new Matrix();
mMatrix.postRotate( -90 + rot*120, mCenter.x, mCenter.y);
f.rawPath.transform(mMatrix);
f.startAngle = mod(alpha_1 -90 + rot*120, 360);
f.endAngle = mod(alpha_2 -90 + rot*120, 360);
}
示例4: getActionPoint
import android.graphics.PointF; //導入方法依賴的package包/類
private PointF getActionPoint(int index, float startAngle, ActionView view) {
PointF point = new PointF(mCenterPoint);
float angle = (float) (Math.toRadians(startAngle) + getActionOffsetAngle(index, view));
point.offset((int) (Math.cos(angle) * getTotalRadius(view.getActionCircleRadiusExpanded())), (int) (Math.sin(angle) * getTotalRadius(view.getActionCircleRadiusExpanded())));
return point;
}