本文整理汇总了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);
}
});
}