popupwindow显示的位置 布局的右上角,标题栏下
2024-10-10 03:47:53
View popview = View.inflate(activity, R.layout.popwindow_layout, null);
int width = Dp2pxUtils.Dp2Px(context, 150f);
popupWindow = new PopupWindow(popview, width, LinearLayout.LayoutParams.WRAP_CONTENT);
AnimationUtils.showTitlePopWindowAnimation(popview);//给popwindow添加动画
initPopWindowListview(popview);
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
View parent = View.inflate(context, R.layout.activity_main_drawerlayout, null);
Rect frame = new Rect();
activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
int x = Dp2pxUtils.Dp2Px(context, 20f);
int titleHeight = Dp2pxUtils.Dp2Px(context, 60f);
/**
* parent:弹窗放置的父布局
* Gravity.TOP + Gravity.RIGHT 该布局的右上角
* x 相对于右上角x方向偏移多少
* fram.top+titleHeight y方向上的偏移值。
*/
popupWindow.showAtLocation(parent, Gravity.TOP + Gravity.RIGHT, x, frame.top + titleHeight);
popupWindow.setOutsideTouchable(true);
popupWindow.setFocusable(true);
popupWindow.update();
popOutShadow(popupWindow);//使popwindow以外区域阴影显示
最新文章
- c++ 陷阱
- NOI 09:奇数求和
- 如果需要将UIView的4个角全部都为圆角,做法相当简单,只需设置其Layer的cornerRadius属性即可
- iOS 学习 - 13.微信分享链接、QQ 分享图片
- sublime exclude folder?
- postgresql pg_hba.conf
- deeplearning.ai 人工智能行业大师访谈 Andrej Karpathy 听课笔记
- 编译安装python3.6后pip3无法安装模块问题处理
- 各位情人节快乐, Python帮忙撒狗粮, 我连夜做了这个程序!
- c/c++ 多线程 层级锁
- ubuntu apt 安装 mpv
- Linux系统安装 OpenSSL两种方法
- Android 程序崩溃之后fragment出现画面重叠问题
- cf1088D Ehab and another another xor problem (构造)
- luogu1397 [NOI2013]矩阵游戏 (等比数列求和)
- UVA - 11732 ";strcmp()"; Anyone? (trie)
- STLINK V2安装使用详解
- Mui --- app与服务器之间的交互原理、mui ajax使用
- 解决使用Properties读取中文乱码问题
- 洛谷P1941 飞扬的小鸟 [noip2014] 背包