1
彈出我使用一個RecycleView
容器內彈出自定義彈出菜單調整彈出菜單。如何當外容器
當視圖觸摸是在底部,在彈出菜單中隱藏的控件波紋管的RecycleView
。
我想在這種情況下調整彈出位置,彈出確切的距離需要所以菜單保持在容器內。
這應該是容易的,但我有困難得到的座標,並從對項目的點擊交易的Adapter
內應用計算。
這是我管理至今:
void show(FragmentActivity activity, View touchedView, DataItem item) {
LayoutInflater layoutInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View popupView = layoutInflater.inflate(R.layout.popup_menu, null);
PopupWindow popupWindow = new PopupWindow(
popupView,
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
popupWindow.setOutsideTouchable(true);
bind(popupWindow, popupView, item);
//draws the menu perfectly bellow the touched element,but doesn't take in account the parent view area
popupWindow.showAsDropDown(touchView);
}
對不起,但問題是如何強制菜單保持在容器內。我不明白你的迴應如何。 – ByteArtisan
糟糕!對不起,我沒有正確讀取的問題。對不起,這.. –