下面列出了android.view.View#getPivotY ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private static void computeRenderOffset(View view, float pivotX, float pivotY) {
if (view.getPivotX() == pivotX && view.getPivotY() == pivotY) {
return;
}
float[] prevPoint = {0.0f, 0.0f};
view.getMatrix().mapPoints(prevPoint);
view.setPivotX(pivotX);
view.setPivotY(pivotY);
float[] currPoint = {0.0f, 0.0f};
view.getMatrix().mapPoints(currPoint);
float offsetX = currPoint[0] - prevPoint[0];
float offsetY = currPoint[1] - prevPoint[1];
view.setTranslationX(view.getTranslationX() - offsetX);
view.setTranslationY(view.getTranslationY() - offsetY);
}
private static void computeRenderOffset(View view, float pivotX, float pivotY) {
if (view.getPivotX() == pivotX && view.getPivotY() == pivotY) {
return;
}
float[] prevPoint = {0.0f, 0.0f};
view.getMatrix().mapPoints(prevPoint);
view.setPivotX(pivotX);
view.setPivotY(pivotY);
float[] currPoint = {0.0f, 0.0f};
view.getMatrix().mapPoints(currPoint);
float offsetX = currPoint[0] - prevPoint[0];
float offsetY = currPoint[1] - prevPoint[1];
view.setTranslationX(view.getTranslationX() - offsetX);
view.setTranslationY(view.getTranslationY() - offsetY);
}
/**
* 获取竖直方向偏转量
* @param view {@link View}
* @return 竖直方向偏转量
*/
public static float getPivotY(final View view) {
if (view != null) {
return view.getPivotY();
}
return 0f;
}
void setView(View view, int width, int height) {
LayoutParams params = new LayoutParams(width, height, Gravity.CENTER_HORIZONTAL);
addView(view, params);
// Setting temporary pivotal point, see #onMeasure()
origPivotY = view.getPivotY();
view.setPivotY(0f);
}
static float getPivotY(View view) {
return view.getPivotY();
}
static float getPivotY(View view) {
return view.getPivotY();
}
public static float getPivotY(View view) {
return view.getPivotY();
}
static float getPivotY(View view) {
return view.getPivotY();
}
static float c(View view)
{
return view.getPivotY();
}
static float getPivotY(View view) {
return view.getPivotY();
}
public static float getPivotY(View view) {
return view.getPivotY();
}
public static float getPivotY(View view) {
return view.getPivotY();
}
static float getPivotY(View view) {
return view.getPivotY();
}
static float getPivotY(View view) {
return view.getPivotY();
}
static float getPivotY(View view) {
return view.getPivotY();
}