我想在点击按钮下方制作下拉自定义对话框。
点击计数器按钮,布局将显示在按钮下方。
我看到了很多链接,但他们只打开列表:-
Action Bar dropdown open and closed item styles
新的快速操作包
上面的链接对我来说不是完整的。
但是当我使用对话框时,它出现在按钮的前面。
所以,如果你知道,请帮助我。
最佳答案
我认为你可以通过使用实现你正在寻找的东西
getLocationOnScreen() 接口(interface) &
PopUpWindow 组件。
示例代码如下。
int[] location = new int[2];
counterView.getLocationOnScreen(location);
final View mView = inflater.inflate(R.layout.xxxx, null, false);
final PopupWindow popUp = new PopupWindow(mView, Width, Height, false);
popUp.setTouchable(true);
popUp.setFocusable(true);
popUp.setOutsideTouchable(true);
popUp.showAtLocation(view, Gravity.NO_GRAVITY, location[0], location[1]);
关于android - 如何在android中单击按钮打开下面的自定义布局对话框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16105875/