常用易混方法及其参数
2015-12-26 17:14
155 查看
*************************************************************
关于动画的参数:
//移动动画
//缩放动画
//旋转动画
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(坐标)
RectF 同上
*************************************************************
布局参数:
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
*************************************************************
关于动画的参数:
//移动动画
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(坐标)
RectF 同上
*************************************************************
布局参数:
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
*************************************************************
相关文章推荐
- PhoneGap/Cordova学习笔记--1.Android环境搭建
- OC中字典基本用法
- Delegate 代理委托 +block+类别Category
- (八)外部中断的设计与应用
- Android通过在布局文件中设置include实现xml布局的复用
- [IOS开发教程] iOS获取设备信息
- 几个高危端口
- WebSocket使用教程 - 带完整实例
- JS面向对象的程序设计
- 如何使用CSS3创建一个漂亮的图标
- android Studio 配置LUA 开发环境
- 判断素数、输出素数以及对称素数---C++
- 织梦dedecms中html和xml格式的网站地图sitemap制作方法
- Emgucv安装
- 【郑轻】[1415]A+B Again!
- 读书笔记——《你的灯亮着吗》(1/2)
- tuzicms美化input(file)浏览按钮代码
- [IOS开发教程] IOS UIDevice & IOS检测屏幕旋转实例
- java.lang.InstantiationException错误
- kinect2.0+opencv获取图像和深度图像