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

  }

posted @ 2011-03-15 11:40  子非あ鱼  阅读(8940)  评论(0编辑  收藏  举报