常用易混方法及其引數

2021-07-09 04:28:55 字數 2925 閱讀 8563

關於動畫的引數:

//移動動畫

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

f 同上

布局引數:

layout方法

:publicvoid

layout(

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(

boolean

changed,

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

解釋幾個常用名詞(易混)

盡量用自己的理解,一句話解釋清楚,想更深了解,請去看百科.一.程序與執行緒區別 程序 程序包含執行緒,多個程序間的資料不共享,由系統進行資源分配 執行緒 執行緒歸屬程序,多個執行緒間的資料可共享,占用資源相對較小,執行更快 二.堆與棧區別 堆 由作業系統自動分配釋放,存放函式的值,先進先出 棧 一般...

HTML的常用易混標籤總結

1.div 和 span 標籤 div 和 span 是沒有語義的,它們就是乙個盒子,用來裝內容。特點 div 標籤用來布局,但是現在一行只能放乙個 div 大盒子 span 標籤用來布局,一行上可以多個 span 小盒子 2.影象標籤和路徑 在html標籤中,img 標籤用於定義html頁面中的影...

jquery on 方法及其引數使用

on 方法在被選元素及子元素上新增乙個或多個事件處理程式。selector on event,childselector,data,function,map 引數 描述event 必需。規定要從被選元素移除的乙個或多個事件或命名空間。由空格分隔多個事件值。必須是有效的事件。childselector...