Android 横屏启动activity,点击屏幕的单击、双击和长按事件

横屏启动activity

  方法1:在androidmanyfest.xml的activity中加入属性 android:screenOrientation="landscape"

  方法2:首先添加
    import android.content.pm.ActivityInfo;
     import android.view.Display;

   在oncreate中加入如下代码 if(getRequestedOrientation()!=ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE){ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);}

  屏幕的单击和双击事件

  mGestureDetector = new GestureDetector(new SimpleOnGestureListener(){

  @Override

  public boolean onDoubleTap(MotionEvent e) {

  // TODO Auto-generated method stub

  return true;

  }

  @Override

  public boolean onSingleTapConfirmed(MotionEvent e) {

  // TODO Auto-generated method stub

  return true;

  }

  @Override

  public void onLongPress(MotionEvent e) {

  // TODO Auto-generated method stub

  }

原文地址:https://www.cnblogs.com/lm3515/p/1984655.html