方向更改时,Android webView会调用不同的URL

时间:2014-11-24 12:02:39

标签: android webview android-orientation

我想调用不同的{{1l当方向从水平变为垂直时意味着浴室布局不同URL我该怎么办?

URL

1 个答案:

答案 0 :(得分:0)

Display display = ((WindowManager) getSystemService(WINDOW_SERVICE))
    .getDefaultDisplay();

int orientation = display.getRotation();

if (orientation == Surface.ROTATION_90
    || orientation == Surface.ROTATION_270) {
    URL = "[your landscape url]";            
} else {
    URL = "[your portrait url]";
}