自定义popWindow布局
来源:互联网 发布:python算法教程 pdf 编辑:程序博客网 时间:2024/06/12 23:44
一,前述:
进来做项目使用到popWindow,主要实现两个功能:其一:布局中添加listView,ListView的adater布局中有EditText其二:实现动画效果
二,popWindow原理方法简介
1,popWindow的构造方法//方法一: public PopupWindow (Context context) //方法二: public PopupWindow(View contentView) //方法三: public PopupWindow(View contentView, int width, int height) //方法四: public PopupWindow(View contentView, int width, int height,boolean focusable) 注意:popwidow没有默认的布局,必须我们手动设置一个contentView。 2,popWindow的显示(3种显示方法)方法一:showAsDropDown(View anchor):-相对于某个控件下方,无偏移方法二:showAsDropDown(View anchor, int xoff, int yoff):-相对于某个控件下方,可以设置偏移方法三:showAtLocation(View parent, int gravity, int x, int y):-相对于父控件下方,可以设置偏移 3,主要方法 public void dismiss() public void setFocusable(boolean focusable) public void setTouchable(boolean touchable) public void setOutsideTouchable(boolean touchable) public void setBackgroundDrawable(Drawable background) 4,动画的实现 public void setAnimationStyle(int animationStyle) 5,使背景变暗 // 设置背景颜色变暗 final WindowManager.LayoutParams lp = this.getWindow().getAttributes(); lp.alpha = 0.7f; this.getWindow().setAttributes(lp); popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { @Override public void onDismiss() { lp.alpha = 1f; MainActivity.this.getWindow().setAttributes(lp); } });
三:代码实现(未完待续)
阅读全文
0 0
- 自定义popWindow布局
- 自定义PopWindow,内部布局自定义
- 自定义 Popwindow
- 自定义popWindow
- PopWindow 自定义
- 自定义PopWindow
- 自定义popwindow
- DIalog与popWindow布局
- DIalog与popWindow布局
- popwindow的布局
- PopWindow实现自定义Menu
- popwindow自定义弹出窗口
- PopWindow:基本使用与自定义PopWindow
- 【Popwindow】自定义popwindow的底部间隙问题
- 利用PopWindow自定义弹出框
- android自定义PopWindow底部显示
- android自定义PopWindow底部显示
- Android popwindow 实现自定义数字键盘
- golang基础-数组、切片创建_内存_底层实现_修改值_拷贝_循环、string与切片
- LeetCode 1. Two Sum
- mysqldump,数据备份与恢复
- 使用BigInteger来处理权限问题,
- 归并排序
- 自定义popWindow布局
- Map的使用
- STM32 模拟 I2C
- depth estimation 深度估计
- python学习之Strings
- 不同环境下python的编辑
- 计算机网络-数据链路层Data Link Layer学习笔记
- Shell笔记
- (C语言版)栈和队列(二)——实现顺序存储栈和顺序存储队列的相关操作