本文整理汇总了Java中android.view.View.setPivotX方法的典型用法代码示例。如果您正苦于以下问题:Java View.setPivotX方法的具体用法?Java View.setPivotX怎么用?Java View.setPivotX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.setPivotX方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hideHint
import android.view.View; //导入方法依赖的package包/类
private void hideHint(final View view) {
view.setPivotX(0);
view.setPivotY(view.getHeight());
Animator iconAnim = ObjectAnimator.ofPropertyValuesHolder(view,
PropertyValuesHolder.ofFloat(View.ALPHA, 1f, 0f),
PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f, 0f));
iconAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
view.setVisibility(View.INVISIBLE);
}
});
iconAnim.start();
}
示例2: layoutItemsOnCreate
import android.view.View; //导入方法依赖的package包/类
/**
* 初始化的时候,layout子View
*/
private void layoutItemsOnCreate(RecyclerView.Recycler recycler) {
int itemCount = getItemCount();
for (int i = 0; i < itemCount; i++) {
View childView = recycler.getViewForPosition(i);
addView(childView);
measureChildWithMargins(childView, View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
layoutItem(childView, locationRects.get(i));
attachedItems.put(i, true);
childView.setPivotY(0);
childView.setPivotX(childView.getMeasuredWidth() / 2);
if (locationRects.get(i).top > getHeight()) {
break;
}
}
}
示例3: onAppear
import android.view.View; //导入方法依赖的package包/类
@Override
public Animator onAppear(ViewGroup sceneRoot, View view,
TransitionValues startValues,
TransitionValues endValues) {
view.setPivotX(view.getWidth());
view.setPivotY(view.getHeight()/2);
return ObjectAnimator.ofFloat(view,View.SCALE_X,0,1).setDuration(400);
}
示例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包/类
@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);
}
示例6: 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;
}
}
}
示例7: onTransform
import android.view.View; //导入方法依赖的package包/类
@Override
protected void onTransform(View page, float position) {
page.setPivotX(position < 0 ? 0 : page.getWidth());
if (position < -1) {//[-infinity,-1)
page.setPivotX(page.getWidth());
}else if (position < 0) {//[-1,0)
page.setPivotX(0);
}else {//[0,+infinity)
page.setPivotX(page.getWidth());
}
page.setScaleX(position < 0 ? 1f + position : 1f - position);
}
示例8: onTransform
import android.view.View; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
final float width = view.getWidth();
final float height = view.getHeight();
final float rotation = ROT_MOD * position * -1.25f;
view.setPivotX(width * 0.5f);
view.setPivotY(height);
view.setRotation(rotation);
}
示例9: transformPage
import android.view.View; //导入方法依赖的package包/类
@Override
public void transformPage(View page, float position) {
final float height = page.getHeight();
final float width = page.getWidth();
page.setPivotY(0.5f * height);
page.setPivotX(0.5f * width);
if (position >= -2 && position <= 2) {
float mFraction = mDirection * (float) Math.abs(Math.sin(Math.PI * position));
page.setRotationY(mFraction * mMaxRotateY);
page.setScaleX(PAGE_SCALE);
page.setScaleY(PAGE_SCALE);
}
}
示例10: transformPage
import android.view.View; //导入方法依赖的package包/类
public void transformPage(View view, float position){
int pageWidth = view.getWidth();
int pageHeight = view.getHeight();
view.setPivotX((float) pageWidth / 2);
view.setPivotY((float) (pageHeight + pageWidth * distanceToCentreFactor));
if(position < -1){ //[-infinity,1)
view.setRotation(0);
view.setAlpha(0);
}else if(position <= 1){ //[-1,1]
view.setTranslationX((-position) * pageWidth); //shift the view over
if(movingForward) {
if (position >= 0) {
view.setRotation(position * (180 - degrees)); //rotate it
// Fade the page relative to its distance from the center
view.setAlpha(Math.max(minAlpha, 1 - Math.abs(position) / 3));
} else {
Log.d("Flip", Float.toString(position));
view.setAlpha(1 + position);
}
}else if(position<=0){
view.setRotation(position * (180 - degrees)); //rotate it
// Fade the page relative to its distance from the center
view.setAlpha(Math.max(minAlpha, 1 - Math.abs(position) / 3));
}else{
Log.d("Flip", Float.toString(position));
view.setAlpha(1 - position);
}
}else{ //(1, +infinity]
view.setRotation(0);
view.setAlpha(0);
}
}
示例11: onTransform
import android.view.View; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
final float scale = 1f + Math.abs(position);
view.setScaleX(scale);
view.setScaleY(scale);
view.setPivotX(view.getWidth() * 0.5f);
view.setPivotY(view.getHeight() * 0.5f);
view.setAlpha(position < -1f || position > 1f ? 0f : 1f - (scale - 1f));
if(position == -1){
view.setTranslationX(view.getWidth() * -1);
}
}
示例12: onTransform
import android.view.View; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
view.setPivotX(position < 0 ? 0 : view.getWidth());
view.setScaleX(position < 0 ? 1f + position : 1f - position);
}
示例13: setPivotX
import android.view.View; //导入方法依赖的package包/类
static void setPivotX(View view, float pivotX) {
view.setPivotX(pivotX);
}
示例14: createAnimator
import android.view.View; //导入方法依赖的package包/类
private static @Nullable
ObjectAnimator createAnimator(@NonNull WXAnimationBean animation, final View target) {
if(target == null){
return null;
}
WXAnimationBean.Style style = animation.styles;
if (style != null) {
ObjectAnimator animator;
List<PropertyValuesHolder> holders =style.getHolders();
if (!TextUtils.isEmpty(style.backgroundColor)) {
BorderDrawable borderDrawable;
if ((borderDrawable=WXViewUtils.getBorderDrawable(target))!=null) {
holders.add(PropertyValuesHolder.ofObject(
WXAnimationBean.Style.BACKGROUND_COLOR, new ArgbEvaluator(),
borderDrawable.getColor(),
WXResourceUtils.getColor(style.backgroundColor)));
} else if (target.getBackground() instanceof ColorDrawable) {
holders.add(PropertyValuesHolder.ofObject(
WXAnimationBean.Style.BACKGROUND_COLOR, new ArgbEvaluator(),
((ColorDrawable) target.getBackground()).getColor(),
WXResourceUtils.getColor(style.backgroundColor)));
}
}
if (style.getPivot() != null) {
Pair<Float, Float> pair = style.getPivot();
target.setPivotX(pair.first);
target.setPivotY(pair.second);
}
animator = ObjectAnimator.ofPropertyValuesHolder(
target, holders.toArray(new PropertyValuesHolder[holders.size()]));
animator.setStartDelay(animation.delay);
final IntEvaluator intEvaluator=new IntEvaluator();
if (target.getLayoutParams() != null &&
(!TextUtils.isEmpty(style.width) || !TextUtils.isEmpty(style.height))) {
DimensionUpdateListener listener = new DimensionUpdateListener(target);
ViewGroup.LayoutParams layoutParams = target.getLayoutParams();
if (!TextUtils.isEmpty(style.width)) {
listener.setWidth(layoutParams.width,
(int) WXViewUtils.getRealPxByWidth(WXUtils.getFloat(style.width)));
}
if (!TextUtils.isEmpty(style.height)) {
listener.setHeight(layoutParams.height,
(int) WXViewUtils.getRealPxByWidth(WXUtils.getFloat(style.height)));
}
animator.addUpdateListener(listener);
}
return animator;
} else {
return null;
}
}