本文整理汇总了Java中android.view.View.setPivotY方法的典型用法代码示例。如果您正苦于以下问题:Java View.setPivotY方法的具体用法?Java View.setPivotY怎么用?Java View.setPivotY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.setPivotY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPreTransform
import android.view.View; //导入方法依赖的package包/类
/**
* Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)}.
* <p>
* The default implementation attempts to reset all view properties. This is useful when toggling transforms that do
* not modify the same page properties. For instance changing from a transformation that applies rotation to a
* transformation that fades can inadvertently leave a fragment stuck with a rotation or with some degree of applied
* alpha.
*
* @param page
* Apply the transformation to this page
* @param position
* Position of page relative to the current front-and-center position of the pager. 0 is front and
* center. 1 is one full page position to the right, and -1 is one page position to the left.
*/
protected void onPreTransform(View page, float position) {
final float width = page.getWidth();
page.setRotationX(0);
page.setRotationY(0);
page.setRotation(0);
page.setScaleX(1);
page.setScaleY(1);
page.setPivotX(0);
page.setPivotY(0);
page.setTranslationY(0);
page.setTranslationX(isPagingEnabled() ? 0f : -width * position);
if (hideOffscreenPages()) {
page.setAlpha(position <= -1f || position >= 1f ? 0f : 1f);
// page.setEnabled(false);
} else {
// page.setEnabled(true);
page.setAlpha(1f);
}
}
示例2: transformPage
import android.view.View; //导入方法依赖的package包/类
@Override
public void transformPage(View view, float position) {
final float scale = MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.abs(position));
final float rotation = MAX_ROTATION * Math.abs(position);
if (position <= 0f) {
view.setTranslationX(view.getWidth() * -position * 0.19f);
view.setPivotY(0.5f * view.getHeight());
view.setPivotX(0.5f * view.getWidth());
view.setScaleX(scale);
view.setScaleY(scale);
view.setRotationY(rotation);
} else if (position <= 1f) {
view.setTranslationX(view.getWidth() * -position * 0.19f);
view.setPivotY(0.5f * view.getHeight());
view.setPivotX(0.5f * view.getWidth());
view.setScaleX(scale);
view.setScaleY(scale);
view.setRotationY(-rotation);
}
}
示例3: onPreTransform
import android.view.View; //导入方法依赖的package包/类
/**
* Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)}.
* <p>
* The default implementation attempts to reset all view properties. This is useful when toggling transforms that do
* not modify the same page properties. For instance changing from a transformation that applies rotation to a
* transformation that fades can inadvertently leave a fragment stuck with a rotation or with some degree of applied
* alpha.
*
* @param page
* Apply the transformation to this page
* @param position
* Position of page relative to the current front-and-center position of the pager. 0 is front and
* center. 1 is one full page position to the right, and -1 is one page position to the left.
*/
protected void onPreTransform(View page, float position) {
final float width = page.getWidth();
page.setRotationX(0);
page.setRotationY(0);
page.setRotation(0);
page.setScaleX(1);
page.setScaleY(1);
page.setPivotX(0);
page.setPivotY(0);
page.setTranslationY(0);
page.setTranslationX(isPagingEnabled() ? 0f : -width * position);
if (hideOffscreenPages()) {
page.setAlpha(position <= -1f || position >= 1f ? 0f : 1f);
page.setEnabled(false);
} else {
page.setEnabled(true);
page.setAlpha(1f);
}
}
示例4: onTransform
import android.view.View; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
view.setPivotX(position < 0 ? 0 : view.getWidth());
view.setPivotY(view.getHeight() / 2f);
float scale = position < 0 ? 1f + position : 1f - position;
view.setScaleX(scale);
view.setScaleY(scale);
}
示例5: onTransform
import android.view.View; //导入方法依赖的package包/类
protected void onTransform(View view, float position) {
float scale = 1.0f + Math.abs(position);
view.setScaleX(scale);
view.setScaleY(scale);
view.setPivotX(((float) view.getWidth()) * 0.5f);
view.setPivotY(((float) view.getHeight()) * 0.5f);
float f = (position < -1.0f || position > 1.0f) ? 0.0f : 1.0f - (scale - 1.0f);
view.setAlpha(f);
if (position == -1.0f) {
view.setTranslationX((float) (view.getWidth() * -1));
}
}
示例6: onTransform
import android.view.View; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
if (position <= 0f) {
view.setTranslationX(0f);
view.setScaleX(1f);
view.setScaleY(1f);
} else if (position <= 1f) {
final float scaleFactor = MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.abs(position));
view.setAlpha(1 - position);
view.setPivotY(0.5f * view.getHeight());
view.setTranslationX(view.getWidth() * -position);
view.setScaleX(scaleFactor);
view.setScaleY(scaleFactor);
}
}
示例7: onTransform
import android.view.View; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
final float rotation = -180f * position;
view.setAlpha(rotation > 90f || rotation < -90f ? 0f : 1f);
view.setPivotX(view.getWidth() * 0.5f);
view.setPivotY(view.getHeight() * 0.5f);
view.setRotationX(rotation);
}
示例8: setOn
import android.view.View; //导入方法依赖的package包/类
public void setOn(View view) {
if (axis == AXIS_X) {
switch (pivotPoint) {
case PIVOT_CENTER:
view.setPivotX(view.getWidth() * 0.5f);
break;
case PIVOT_MAX:
view.setPivotX(view.getWidth());
break;
default:
view.setPivotX(pivotPoint);
break;
}
return;
}
if (axis == AXIS_Y) {
switch (pivotPoint) {
case PIVOT_CENTER:
view.setPivotY(view.getHeight() * 0.5f);
break;
case PIVOT_MAX:
view.setPivotY(view.getHeight());
break;
default:
view.setPivotY(pivotPoint);
break;
}
}
}
示例9: onTransform
import android.view.View; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
view.setPivotX(position < 0 ? 0 : view.getWidth());
view.setPivotY(view.getHeight() / 2f);
float scale = position < 0 ? 1f + position : 1f - position;
view.setScaleX(scale);
view.setScaleY(scale);
}
示例10: onTransform
import android.view.View; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
final float rotation = 180f * position;
view.setAlpha(rotation > 90f || rotation < -90f ? 0 : 1);
view.setPivotX(view.getWidth() * 0.5f);
view.setPivotY(view.getHeight() * 0.5f);
view.setRotationY(rotation);
}
示例11: onTransform
import android.view.View; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
Log.e("cubein",view.getWidth()+":"+view.getHeight());
// Rotate the fragment on the left or right edge
view.setPivotX(position > 0 ? 0 : view.getWidth());
view.setPivotY(0);
view.setRotationY(-90f * position);
}
示例12: onTransform
import android.view.View; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
final float rotation = (position < 0 ? 30f : -30f) * Math.abs(position);
view.setTranslationX(getOffsetXForRotation(rotation, view.getWidth(), view.getHeight()));
view.setPivotX(view.getWidth() * 0.5f);
view.setPivotY(0);
view.setRotationY(rotation);
}
示例13: onTransform
import android.view.View; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
final float rotation = 180f * position;
view.setAlpha(rotation > 90f || rotation < -90f ? 0 : 1);
view.setPivotX(view.getWidth() * 0.5f);
view.setPivotY(view.getHeight() * 0.5f);
view.setRotationY(rotation);
}
示例14: onTransform
import android.view.View; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
final float height = view.getHeight();
final float width = view.getWidth();
final float scale = min(position > 0 ? 1f : Math.abs(1f + position), 0.5f);
view.setScaleX(scale);
view.setScaleY(scale);
view.setPivotX(width * 0.5f);
view.setPivotY(height * 0.5f);
view.setTranslationX(position > 0 ? width * position : -width * position * 0.25f);
}
示例15: onTransform
import android.view.View; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
if (position >= -1 || position <= 1) {
// Modify the default slide transition to shrink the page as well
final float height = view.getHeight();
final float width = view.getWidth();
final float scaleFactor = Math.max(MIN_SCALE, 1 - Math.abs(position));
final float vertMargin = height * (1 - scaleFactor) / 2;
final float horzMargin = width * (1 - scaleFactor) / 2;
// Center vertically
view.setPivotY(0.5f * height);
view.setPivotX(0.5f * width);
if (position < 0) {
view.setTranslationX(horzMargin - vertMargin / 2);
} else {
view.setTranslationX(-horzMargin + vertMargin / 2);
}
// Scale the page down (between MIN_SCALE and 1)
view.setScaleX(scaleFactor);
view.setScaleY(scaleFactor);
// Fade the page relative to its size.
view.setAlpha(MIN_ALPHA + (scaleFactor - MIN_SCALE) / (1 - MIN_SCALE) * (1 - MIN_ALPHA));
}
}