<uses-permission android:name="android.permission.CHANGE_CONFIGURATION"/>
2.声明Activity可以捕获的事件类型
<activity
android:name="com.example.widget_high_demo.MainActivity"
android:label="@string/app_name"
android:configChanges="orientation|keyboard|screenSize"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
3.在Activity里面重写