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