当前位置: 首页 > news >正文

自己做网站服务器安徽百度seo公司

自己做网站服务器,安徽百度seo公司,物流 东莞网站建设,做一个网站的步骤系列文章目录 文章目录 一、 从0开始实现 onCreate 的setContentView二、 从0 开始实现 onMeasure三、 从0 开始实现 onLayout四、 从0 开始实现 onDraw总结 前言 接上文,测量完View树的每个节点View的宽和高后,开始布局。 一、ViewRootImpl 的调用栈…

系列文章目录

文章目录
  • 一、 从0开始实现 onCreate 的setContentView
  • 二、 从0 开始实现 onMeasure
  • 三、 从0 开始实现 onLayout
  • 四、 从0 开始实现 onDraw
  • 总结

前言

接上文,测量完View树的每个节点View的宽和高后,开始布局。

一、ViewRootImpl 的调用栈

ViewRootImpl->performLayout(lp, mWidth, mHeight);

                        host.layout()

ViewGroup -> layout(int l, int t, int r, int b)

View -> layout(int l, int t, int r, int b)

View ->setFrame(l, t, r, b)

           onLayout(changed, l, t, r, b)

DecorView-> onLayout(changed, l, t, r, b)

FrameLayout->onLayout()

                        layoutChildren()

二、布局每个View

View.java  layout() 函数先设置自己的 left, right, top, bottom ,再做onLayout动作, onLayout的意图是布局 子控件。 view 已经没有子控件了, 所以 view的onLayout 什么也不做。

protected int mLeft;protected int mRight;protected int mTop;protected int mBottom;public void layout(int l, int t, int r, int b) {boolean changed = isLayoutModeOptical(mParent) ?setOpticalFrame(l, t, r, b) : setFrame(l, t, r, b);if (changed || (mPrivateFlags & PFLAG_LAYOUT_REQUIRED) == PFLAG_LAYOUT_REQUIRED) {onLayout(changed, l, t, r, b);
}}protected boolean setFrame(int left, int top, int right, int bottom) {...mLeft = left;mTop = top;mRight = right;mBottom = bottom;...
}protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
}

由于 ViewGroup 的 onLayout 是虚函数, 所以 ViewGroup 需要实现自己的onLayout

   public final void layout(int l, int t, int r, int b) {if (!mSuppressLayout && (mTransition == null || !mTransition.isChangingLayout())) {if (mTransition != null) {mTransition.layoutChange(this);}super.layout(l, t, r, b);} else {// record the fact that we noop'd it; request layout when transition finishesmLayoutCalledWhileSuppressed = true;}
}protected abstract void onLayout(boolean changed,int l, int t, int r, int b);

总结:

View 树的布局实际是给 每个view子节点的 mLeft, mTop, mRight, mBottom 四个成员变量赋值, 这四个成员变量代表 了 view 这个矩形框的位置和大小。

http://www.dt0577.cn/news/3400.html

相关文章:

  • 做网站的时候宽度都怎么弄百度网址大全简单版
  • wordpress关闭网站吗查询网站
  • 公司网站的建设与运营管理制度百度站长收录入口
  • ps和vscode做网站石家庄手机端seo
  • 网站建设与规划实验心得百度站长工具怎么关闭教程视频
  • 数据推广是干什么的google seo是什么
  • 楚雄建网站谷歌搜索引擎入口2021
  • 国外免费网站建设网站需要改进的地方
  • 中信建设海南有限责任公司郑州seo公司
  • 网站改版建设的目的成都比较靠谱的seo
  • 备案编号不放在网站引擎搜索大全
  • 房产网站的全景图怎么做百度sem优化师
  • wordpress5分钟安装河北网站优化公司
  • 在哪里做网站武汉网络推广有限公司
  • 毕设做网站怎么弄代码设计怎么在百度上发帖推广
  • 给公司做网站要花多钱谷歌seo优化中文章
  • 做进化树的网站网站seo哪家公司好
  • 联想官网网上商城怎么优化网站排名
  • 广州网站建设平台安卓优化大师最新版下载
  • 人像摄影网站营销策略有哪些
  • wordpress隐藏设置百度关键词优化多少钱
  • 建网站找哪里青岛网络科技公司排名
  • 昆明会员网站建设电商线上推广
  • 苏州网站建设公司书生商友响应式网站建设
  • 哈尔滨建筑工程招聘信息搜索引擎优化培训班
  • 怎样用ps做网站banner网络建设推广
  • 四大门户网站现状万秀服务不错的seo推广
  • 最新网站技术网络营销的市场背景
  • 汉中专业网站建设推广百度高级搜索首页
  • 网站开发技术培训seo自动优化软件安卓