常用易混方法及其参数

来源:互联网 发布:麦克雷爆头伤害数据 编辑:程序博客网 时间:2024/06/12 19:39

*************************************************************

关于动画的参数:

//移动动画

TranslateAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta)
        

TranslateAnimation(int fromXType, float fromXValue, int toXType, float toXValue, int fromYType, float fromYValue, int toYType, float toYValue)

//缩放动画

ScaleAnimation(float fromX, float toX, float fromY, float toY)
         

ScaleAnimation(float fromX, float toX, float fromY, float toY, float pivotX, float pivotY)
        

ScaleAnimation(float fromX, float toX, float fromY, float toY, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue)


//旋转动画

RotateAnimation(float fromDegrees, float toDegrees)


RotateAnimation(float fromDegrees, float toDegrees, float pivotX,                       float pivotY)

RotateAnimation(float fromDegrees, float toDegrees, int pivotXType,                       float pivotXValue,    int pivotYType,     float pivotYValue)
//淡入淡出

AlphaAnimation(float fromAlpha, float toAlpha)

*************************************************************

形状参数:

public  Rect(int left, int top, int right, int bottom)
Create a new rectangle with the specified coordinates. Note: no range checking is performed, so the caller must ensure that left <= right and top <= bottom. 

参数:

left- The X coordinate of the left side of the rectagle

top- The Y coordinate of the top of the rectangle

right- The X coordinate of the right side of the rectagle

bottom- The Y coordinate of the bottom of the rectangle

注:coordinate(坐标)

Rect同上

*************************************************************

布局参数:

layout方法publicvoidlayout(intl,intt,intr,intb);

该方法是View的放置方法,在View类实现。调用该方法需要传入放置View的矩形空间左上角left、top值和右下角right、bottom值。这些值是相对于父控件而言的例如传入的是(10, 10, 100, 100),则该View在距离父控件的左上角位置(10, 10)处显示,显示的大小是宽高是90(参数r,b是相对左上角的),这有点像绝对布局。

onlayout方法@Override protected abstractvoid onLayout(booleanchanged,

            intl,intt,intr,intb);

该方法在ViewGroup中定义是抽象函数,继承该类必须实现onLayout方法,而ViewGroup的onMeasure并非必须重写的。View的放置都是根据一个矩形空间放置的,onLayout传下来的l,t,r,b分别是放置父控件的矩形可用空间(除去margin和padding的空间)的左上角的left、top以及右下角right、bottom值。

*************************************************************

//关于滚动:

view.scrollBy(int x, int y)

Move the scrolled position of your view. This will cause a call to onScrollChanged(int, int, int, int) and the view will be invalidated. 

参数:

x- the amount of pixels to scroll by horizontally(X方向上移动的像素)

y- the amount of pixels to scroll by vertically(Y方向上移动的像素)

view.scrollTo(int x,  int y)

Set the scrolled position of your view. This will cause a call to onScrollChanged(int, int, int, int) and the view will be invalidated. 

参数:

x- the x position to scroll to

y- the y position to scroll to

*************************************************************

0 0
原创粉丝点击