我是android新手。 我是與Android帆布工作,我不知道,當它們的功能界定及在Android源代碼空SurfaceView類的功能如何做的工作。這裏是Android面視圖類的源代碼當函數定義爲空時,SurfaceView類的函數如何工作?
package android.view;
import com.android.layoutlib.bridge.MockView;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.util.AttributeSet;
public class SurfaceView extends MockView {
public SurfaceView(Context context) {
this(context, null);
}
public SurfaceView(Context context, AttributeSet attrs) {
this(context, attrs , 0);
}
public SurfaceView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public SurfaceHolder getHolder() {
return mSurfaceHolder;
}
private SurfaceHolder mSurfaceHolder = new SurfaceHolder() {
@Override
public boolean isCreating() {
return false;
}
@Override
public void addCallback(Callback callback) {
}
@Override
public void removeCallback(Callback callback) {
}
@Override
public void setFixedSize(int width, int height) {
}
@Override
public void setSizeFromLayout() {
}
@Override
public void setFormat(int format) {
}
@Override
public void setType(int type) {
}
@Override
public void setKeepScreenOn(boolean screenOn) {
}
@Override
public Canvas lockCanvas() {
return null;
}
@Override
public Canvas lockCanvas(Rect dirty) {
return null;
}
@Override
public void unlockCanvasAndPost(Canvas canvas) {
}
@Override
public Surface getSurface() {
return null;
}
@Override
public Rect getSurfaceFrame() {
return null;
}
};
}
所以如何做這項工作時,我們寫
canvas c = holder.lockCanvas(null);
或
holder.unlockCanvasAndPost(c);
當我們在源代碼中沒有要處理。我的意思是哪裏出了鱈魚e完成工作。如果幫我找到它..
謝謝,但爲什麼它沒有顯示在SDK中給出的android源代碼 – user3198091