浏览代码

Merge pull request #269 from UnityTech/androidfix

Androidfix
/main
GitHub 5 年前
当前提交
04e39e7b
共有 1 个文件被更改,包括 17 次插入1 次删除
  1. 18
      Runtime/Plugins/platform/android/view/UIWidgetsViewController.java

18
Runtime/Plugins/platform/android/view/UIWidgetsViewController.java


private UIWidgetsViewMetrics viewMetrics;
private boolean keyboardOpen;
private float statusHeight;
private float navigationBarHeight;
setupHeights();
}
private void setupHeights() {
final View unityView = ((ViewGroup)UnityPlayer.currentActivity.findViewById(android.R.id.content)).getChildAt(0);
Rect rect = new Rect();
unityView.getWindowVisibleDisplayFrame(rect);
statusHeight = rect.top;
navigationBarHeight = unityView.getRootView().getHeight() - rect.bottom;
}
public static UIWidgetsViewMetrics getMetrics() {

viewMetrics.insets_right = 0;
viewMetrics.insets_bottom = navigationBarHidden? calculateBottomKeyboardInset(rect) : rect.bottom;
viewMetrics.insets_left = 0;
//adjust
viewMetrics.insets_bottom -= navigationBarHeight;
viewMetrics.padding_top -= statusHeight;
//Log.i("UIWidgetsDebug", "checks: " + navigationBarHidden + " " + rect.bottom);
//Log.i("UIWidgetsDebug", " padding: " + viewMetrics.padding_top + " " + viewMetrics.padding_right + " " + viewMetrics.padding_bottom + " " + viewMetrics.padding_left);

正在加载...
取消
保存