suppender
9/8/2017 - 9:40 AM

在运行时确定配置,选择相关布局或图片

在运行时确定配置,选择相关布局或图片

String image;
int orientation = getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
   image = "image_portrait.png";
   // ...
} else if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
   image = "image_landscape.png";
   // ...
}