android.view.SurfaceView.setOnTouchListener()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(372)

本文整理了Java中android.view.SurfaceView.setOnTouchListener()方法的一些代码示例,展示了SurfaceView.setOnTouchListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SurfaceView.setOnTouchListener()方法的具体详情如下:
包路径:android.view.SurfaceView
类名称:SurfaceView
方法名:setOnTouchListener

SurfaceView.setOnTouchListener介绍

暂无

代码示例

代码示例来源:origin: florent37/CameraFragment

surfaceView.setOnTouchListener(new View.OnTouchListener() {
  @Override
  public boolean onTouch(View v, MotionEvent event) {

代码示例来源:origin: FauDroids/Bored-Rudolf

@Override
public void surfaceCreated(SurfaceHolder holder) {
  surfaceHolder = holder;
  surfaceView.setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
      switch (event.getAction()) {
        case MotionEvent.ACTION_UP:
        case MotionEvent.ACTION_MOVE:
        case MotionEvent.ACTION_DOWN:
          gameManager.onPlayerTouch(event.getX());
          break;
        default:
          break;
      }
      return true;
    }
  });
}

代码示例来源:origin: sxpl/FaceAC

private void addListener() {
  this.tvCancle.setOnClickListener(this);
  this.takePic.setOnClickListener(this);
  this.mSurfaceView.setOnTouchListener(this);
}

代码示例来源:origin: maimingliang/WxRecoderVideo

private void setListener() {
  if (DeviceUtils.hasICS()) {
    mSurfaceView.setOnTouchListener(onSurfaveViewTouchListener);
  }
  mBtnPress.setOnTouchListener(onVideoRecoderTouchListener);
  mTvRecorderCancel.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
      onBackPressed();
    }
  });
}

代码示例来源:origin: brucetoo/VideoControllerView

public VideoControllerView(Builder builder) {
  super(builder.context);
  this.mContext = builder.context;
  this.mMediaPlayerControlListener = builder.mediaPlayerControlListener;
  this.mVideoTitle = builder.videoTitle;
  this.mCanSeekVideo = builder.canSeekVideo;
  this.mCanControlVolume = builder.canControlVolume;
  this.mCanControlBrightness = builder.canControlBrightness;
  this.mExitIcon = builder.exitIcon;
  this.mPauseIcon = builder.pauseIcon;
  this.mPlayIcon = builder.playIcon;
  this.mStretchIcon = builder.stretchIcon;
  this.mShrinkIcon = builder.shrinkIcon;
  this.mSurfaceView = builder.surfaceView;
  setAnchorView(builder.anchorView);
  this.mSurfaceView.setOnTouchListener(new OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
      toggleControllerView();
      return false;
    }
  });
}

代码示例来源:origin: karanvs/ExVidPlayer

private void setUpGestureControls() {
 surfaceView.setOnTouchListener(new ExVidPlayerGestureListener(getActivity()));
}

代码示例来源:origin: karanvs/ExVidPlayer

private void setUpGestureControls() {
 surfaceView.setOnTouchListener(new ExVidPlayerGestureListener(getActivity()));
}

代码示例来源:origin: stackoverflow.com

super.onCreate(b);
mDrawingSurfaceView = new SurfaceView(this);
mDrawingSurfaceView.setOnTouchListener(mCanvasTouchListener);
setContentView(mDrawingSurfaceView);
mBall = new Ball(Color.RED, 40);

代码示例来源:origin: werbhelius/MediaUtils

public void setSurfaceView(SurfaceView view) {
  this.mSurfaceView = view;
  mSurfaceHolder = mSurfaceView.getHolder();
  mSurfaceHolder.setFixedSize(previewWidth, previewHeight);
  mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  mSurfaceHolder.addCallback(this);
  mDetector = new GestureDetector(activity, new ZoomGestureListener());
  mSurfaceView.setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
      mDetector.onTouchEvent(event);
      return true;
    }
  });
}

代码示例来源:origin: ysq1051838264/CustomCamera

mSurfaceView.setOnTouchListener(new View.OnTouchListener() {
  @Override
  public boolean onTouch(View v, MotionEvent event) {

代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java

@Override
protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
 setContentView(R.layout.activity_custom);
 getSupportActionBar().setDisplayHomeAsUpEnabled(true);
 getSupportActionBar().setHomeButtonEnabled(true);
 SurfaceView surfaceView = findViewById(R.id.surfaceView);
 surfaceView.getHolder().addCallback(this);
 surfaceView.setOnTouchListener(this);
 rtmpCamera1 = new RtmpCamera1(surfaceView, this);
 prepareOptionsMenuViews();
 etUrl = findViewById(R.id.et_rtp_url);
 etUrl.setHint(R.string.hint_rtmp);
 bStartStop = findViewById(R.id.b_start_stop);
 bStartStop.setOnClickListener(this);
 bRecord = findViewById(R.id.b_record);
 bRecord.setOnClickListener(this);
 Button switchCamera = findViewById(R.id.switch_camera);
 switchCamera.setOnClickListener(this);
}

代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java

@Override
protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
 setContentView(R.layout.activity_custom);
 getSupportActionBar().setDisplayHomeAsUpEnabled(true);
 getSupportActionBar().setHomeButtonEnabled(true);
 surfaceView = findViewById(R.id.surfaceView);
 surfaceView.getHolder().addCallback(this);
 surfaceView.setOnTouchListener(this);
 rtspCamera1 = new RtspCamera1(surfaceView, this);
 prepareOptionsMenuViews();
 etUrl = findViewById(R.id.et_rtp_url);
 etUrl.setHint(R.string.hint_rtsp);
 bStartStop = findViewById(R.id.b_start_stop);
 bStartStop.setOnClickListener(this);
 bRecord = findViewById(R.id.b_record);
 bRecord.setOnClickListener(this);
 Button switchCamera = findViewById(R.id.switch_camera);
 switchCamera.setOnClickListener(this);
}

代码示例来源:origin: stackoverflow.com

sv.setOnTouchListener(this);
btnClear = (Button)findViewById(R.id.btnClear);
path = new Path();

代码示例来源:origin: zxfnicholas/CameraSDK

surfaceView.setOnTouchListener(new OnTouchListener() {

代码示例来源:origin: lfkdsk/JustWeEngine

e_surfaceView.setOnTouchListener(this);

代码示例来源:origin: harjot-oberai/AndroidDigitClassifier

previewImg = (ImageView) findViewById(R.id.preview_img);
preview.setOnTouchListener(new View.OnTouchListener() {
  @Override
  public boolean onTouch(View v, MotionEvent event) {

代码示例来源:origin: tony-Shx/Swface

mFaceSurface.setOnTouchListener(new OnTouchListener() {

代码示例来源:origin: jcampbell05/NiceSupportMapFragment

surfaceView.setOnTouchListener(new OnTouchListener());

代码示例来源:origin: changer0/WeiChatSampleVideo

private void initView() {
  videoWidth = 640;
  videoHeight = 480;
  mSurfaceView = (SurfaceView) findViewById(R.id.main_surface_view);
  mDetector = new GestureDetector(this, new ZoomGestureListener());
  /**
   * 单独处理mSurfaceView的双击事件
   */
  mSurfaceView.setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
      mDetector.onTouchEvent(event);
      return true;
    }
  });
  mSurfaceHolder = mSurfaceView.getHolder();
  //设置屏幕分辨率
  mSurfaceHolder.setFixedSize(videoWidth, videoHeight);
  mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  mSurfaceHolder.addCallback(this);
  mStartButton = findViewById(R.id.main_press_control);
  mTvTip = (TextView) findViewById(R.id.main_tv_tip);
  mStartButton.setOnTouchListener(this);
  //自定义双向进度条    (这个地方差点把我急疯了!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!)
  mProgressBar = (BothWayProgressBar) findViewById(R.
      id.main_progress_bar);
  mProgressBar.setOnProgressEndListener(this);
  mHandler = new MyHandler(this);
  mMediaRecorder = new MediaRecorder();
}

代码示例来源:origin: small-dream/VideoRecord

mSurfaceView.setOnTouchListener(mOnSurfaveViewTouchListener);

相关文章