在AndroidManifest.xml文件中设置如下:
<activity android:name=".MainActivity" android:screenOrientation="landscape">