Android-PickerView 对话框被挡住了一部分,

ibrsph3r  于 2022-10-22  发布在  Android
关注(0)|答案(2)|浏览(111)

在小米k30上面,手机选择全面屏经典模式,既有底部导航键,弹出对话框后,底部导航栏会被对话框挡住一部分。有没有网友遇到过这种情况的,用原生dialog不会出现挡住,我粗略看了源码 ,是基于view了,不清楚,是否有解决方案

yjghlzjz

yjghlzjz1#

我也遇到了这种问题,我的是非dialog模式下底部虚拟键和弹框重合了,我的解决方法是使用dialog模式,显示到底部,然后把布局的Margin值改为0,代码大致是这样的:
TimePickerView build = new TimePickerBuilder(context, listener)
.setType(booleans)
.setTitleText(title)
.isDialog(true)
.setDate(currentDate)
.setRangDate(startDate, endDate)
.build();
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) build.getDialogContainerLayout().getLayoutParams();
lp.leftMargin = 0;
lp.rightMargin = 0;
build.getDialog().getWindow().setGravity(Gravity.BOTTOM);
build.getDialog().getWindow().setWindowAnimations(R.style.picker_view_slide_anim);
build.show();

8gsdolmq

8gsdolmq2#

感谢! 在 2021-02-26 11:28:39,"cuvette0205" notifications@github.com 写道: 我也遇到了这种问题,我的是非dialog模式下底部虚拟键和弹框重合了,我的解决方法是使用dialog模式,显示到底部,然后把布局的Margin值改为0,代码大致是这样的: TimePickerView build = new TimePickerBuilder(context, listener) .setType(booleans) .setTitleText(title) .isDialog(true) .setDate(currentDate) .setRangDate(startDate, endDate) .build(); FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) build.getDialogContainerLayout().getLayoutParams(); lp.leftMargin = 0; lp.rightMargin = 0; build.getDialog().getWindow().setGravity(Gravity.BOTTOM); build.getDialog().getWindow().setWindowAnimations(R.style.picker_view_slide_anim); build.show(); — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

相关问题