[英]How to use layout-land and android:configChanges=orientation|screenSize together in application?
[英]How to use values-land with configChanges=orientation
有没有办法
android:configChanges="orientation"
并且还更新了旋转时的android样式,以在用户旋转至横向时使用values-land中的值?
@Override
public void onConfigurationChanged(Configuration config) {
super.onConfigurationChanged(config);
if (config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
//changes in code for landscape
} else if (config.orientation == Configuration.ORIENTATION_PORTRAIT){
//changes in code for portrait
}
}
您也可以为单项活动的横向/纵向模式创建布局
res/layout: portrait
res/layout-land: landscape
我发现没有简单的方法可以做到这一点。 我最终只是按照其他答案的建议手动更新了样式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.