本文整理匯總了Java中android.view.SurfaceView.setOnClickListener方法的典型用法代碼示例。如果您正苦於以下問題:Java SurfaceView.setOnClickListener方法的具體用法?Java SurfaceView.setOnClickListener怎麽用?Java SurfaceView.setOnClickListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.SurfaceView
的用法示例。
在下文中一共展示了SurfaceView.setOnClickListener方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import android.view.SurfaceView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
surfaceBoxView = (TextView) findViewById(R.id.surfaceBoxView);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle("百裏挑一");
setSupportActionBar(toolbar);
mView = (SurfaceView) findViewById(R.id.surfaceView);
mHolder = mView.getHolder();
mHolder.addCallback(this);
photos.clear();
rl();
mView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mView.setAlpha(0);
mCamera.takePicture(null, null , picCallback);
rl();
mView.setAlpha(1);
}
});
}
示例2: example
import android.view.SurfaceView; //導入方法依賴的package包/類
private void example() {
// Prevent window dimming
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
// Initialize accelerometer
sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
sensorAccelerometer = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
sensorManager.registerListener(this, sensorAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);
// Initializes RenderScript context
initRenderScript();
// Here we get our TextureView, and apply a hack (setScaleX) to enable smoothing of the
// final output image
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.surfaceView);
// Sets surface callback, to understand when the surface will be available
surfaceView.getHolder().addCallback(mSurfaceViewCallback);
surfaceView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// After touching the surface, application will end.
if (rsLoop != null)
rsLoop.interrupt();
System.exit(0);
}
});
}