我有一个Android应用程序,可在启动时向窗口添加视图。我的视图正确显示,但是每当我打开键盘时,我的视图都会调整大小,以使其适合屏幕顶部和键盘顶部之间。我尝试将softInputMode
设置为SOFT_INPUT_ADJUST_PAN
,但这无济于事。实际上,将其更改为任何内容似乎都没有效果。
我的限制是:
WindowManager.addView()
)TYPE_PHONE
到目前为止,我的代码:
public DisplayManager(Context context) {
this.context = context;
this.windowManager = (WindowManager) this.context.getSystemService(Context.WINDOW_SERVICE);
this.isDisplayed = false;
this.layoutParameters = new WindowManager.LayoutParams(WindowManager.LayoutParams.TYPE_PHONE);
/*this.layoutParameters.width = WindowManager.LayoutParams.MATCH_PARENT;
this.layoutParameters.height = WindowManager.LayoutParams.MATCH_PARENT;*/
this.layoutParameters.flags = WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN;
this.layoutParameters.format = PixelFormat.TRANSLUCENT;
this.layoutParameters.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN;
}
public void show() {
if (this.isDisplayed == false) {
if (this.mainView == null)
this.mainView = MainView_.build(this.context);
this.windowManager.addView(this.mainView, this.layoutParameters);
this.mainView.viewDisplayed();
this.isDisplayed = true;
}
}