自定义view group
来源:互联网 发布:乱世佳人电影结局知乎 编辑:程序博客网 时间:2024/05/17 13:39
https://github.com/wanglianghai/ImageSelectContainer/commit/9a08dc6665bd765aa52f2257c65b361a4934d1aa
//如果不定义,用父视图的给出测量大小@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) //子视图放的位置, onLayout会被调用多次,注意集合 @Override protected void onLayout(boolean changed, int l, int t, int r, int b) //设置坐标只要两个值,相对的加 v.layout(horizon, t, horizon += preWidthR, vertical + t);//if判断换行后在计算结果
/** * Assign a size and position to a view and all of its * descendants给一个视图和其子视图大小和位置 * * <p>This is the second phase of the layout mechanism.这是第二个布局进程的阶段 * (The first is measuring). In this phase, each parent calls第一个是测量。在这个阶段,每个父View调用 * layout on all of its children to position them.layout让所有的父的子视图去放自己的位置。 * This is typically done using the child measurements这是一个代表性的用在测量后被储存子视图测量值 * that were stored in the measure pass().</p> * * <p>Derived classes should not override this method.继承的class不应该覆盖这方法 * Derived classes with children should override继承类和子类应该覆盖onLayout * onLayout. In that method, they should在这个方法,他们应该 * call layout on each of their children.</p>调用layout对于他的每一个子类 * * @param l Left position, relative to parent相对于父视图 * @param t Top position, relative to parent * @param r Right position, relative to parent * @param b Bottom position, relative to parent */ @SuppressWarnings({"unchecked"}) public void layout(int l, int t, int r, int b) {
多看英文意思,要看明白,看明白了就好解决一些方法的调用错误问题
阅读全文
1 0
- 自定义view group
- 自定义view group 1
- view group
- 自定义分组Group
- MapReduce自定义分组Group
- Hadoop自定义分组Group
- hadoop自定义分组group
- 自定义-Hadoop自定义分组Group
- 2G03-view-radio-group
- view group adapter的封装
- 自定义view
- 自定义View
- 自定义view
- 自定义View
- 自定义View
- 自定义view
- 自定义View
- 自定义view
- java运算符
- Linux下解决Qt连接MySql找不到驱动的问题
- 难理解的c代码(1)
- arraycopy方法和二维数组
- Fiddler--下载安装、原理、教程
- 自定义view group
- Java基础知识总结(绝对经典)
- [题解]hdu5634 Rikka with Phi
- 【经验随笔】Restlet Client发送XML格式参数消息
- i2c 相关知识总结
- CentOS6.4 配置iptables
- 端口被占用问题
- stack链式C++
- 【HTML5学习笔记】20:CSS文本样式 下