There are various ways to do it, but as given here, using
android:configChanges="keyboardHidden|orientation|screenSize"
allows you to listen for the config changes. You then respond to these changes by overriding onConfigurationChanged
and calling setContentView
.
This is the way I've been doing it, but I'd be interested to know other people's thoughts.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…