横屏启动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

  }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-22
  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-07
  • 2022-02-11
  • 2022-12-23
  • 2021-11-24
相关资源
相似解决方案