【发布时间】:2020-02-02 18:45:46
【问题描述】:
在我的 GridView 中,当用户长按时,我会显示一个弹出窗口。但根据文档,如果没有空间,Popupwindow 会尝试滚动视图的父级。 而这正是我想要避免的。
showAsDropDown(查看锚点) 如果屏幕上没有足够的空间显示 * 整个弹出窗口,这个方法试图找到一个父滚动 * 滚动查看。
我查看了 Popupwindow 文档,发现以下方法可以实现我的目标(避免滚动父级),但不支持应用使用。
/**
* Allow PopupWindow to scroll the anchor's parent to provide more room
* for the popup. Enabled by default.
*
* @param enabled True to scroll the anchor's parent when more room is desired by the popup.
*/
@UnsupportedAppUsage
void setAllowScrollingAnchorParent(boolean enabled) {
mAllowScrollingAnchorParent = enabled;
}
【问题讨论】:
标签: android gridview android-gridview