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

做美团网这种网站赚钱吗深圳sem竞价托管

做美团网这种网站赚钱吗,深圳sem竞价托管,中国工程招标网采购招标网,如何将自己做的网站放到网上去文章目录 入口DecorView如何加载到Window中MeasureSpec MeasureView的测量ViewGroup的测量 LayoutView的layout() Draw1、绘制背景3、绘制View内容4、绘制子View6、绘制装饰 入口 DecorView如何加载到Window中 MeasureSpec 该类是View的内部类,封装View的规格尺寸…

文章目录

  • 入口
    • DecorView如何加载到Window中
    • MeasureSpec
  • Measure
    • View的测量
    • ViewGroup的测量
  • Layout
    • View的`layout()`
  • Draw
    • 1、绘制背景
    • 3、绘制View内容
    • 4、绘制子View
    • 6、绘制装饰

在这里插入图片描述

入口

DecorView如何加载到Window中

在这里插入图片描述


MeasureSpec

该类是View的内部类,封装View的规格尺寸。
在这里插入图片描述
他就是一个32位的int值,高2为代表 specMode(测量模式),低30位代表specSize(测量大小)
specMode:UNSPECIFIED AT_MOST EXACTLY

对于每个View都有对应的MeasureSpec,在测量流程中,通过makeMeasureSpec() 来保存宽和高,通过
getMode()getSize() 得到模式和宽高
MeasureSpec自身的布局参数和父容器的测量规格共同影响

那么顶层View的DecorView没有父容器,怎么得到测量规格呢?
通过getRootMeasureSpec()

/*** 根据窗口大小和根视图尺寸,获取根视图的MeasureSpec** @param windowSize    窗口大小* @param rootDimension 根视图尺寸* @return 根视图的MeasureSpec*/
private static int getRootMeasureSpec(int windowSize, int rootDimension) {int measureSpec;switch (rootDimension) {case ViewGroup.LayoutParams.MATCH_PARENT:// 如果根视图尺寸为MATCH_PARENT(即填充父窗口),窗口无法调整大小。// 强制根视图尺寸为窗口大小,使用MeasureSpec.EXACTLY模式。measureSpec = MeasureSpec.makeMeasureSpec(windowSize, MeasureSpec.EXACTLY);break;case ViewGroup.LayoutParams.WRAP_CONTENT:// 如果根视图尺寸为WRAP_CONTENT(即自适应内容),窗口可以调整大小。// 设置根视图最大尺寸为窗口大小,使用MeasureSpec.AT_MOST模式。measureSpec = MeasureSpec.makeMeasureSpec(windowSize, MeasureSpec.AT_MOST);break;default:// 如果根视图尺寸为具体的数值,窗口希望有确定的大小。// 强制根视图尺寸为指定的大小,使用MeasureSpec.EXACTLY模式。measureSpec = MeasureSpec.makeMeasureSpec(rootDimension, MeasureSpec.EXACTLY);break;}return measureSpec;
}

Measure

在某些极端情况下,系统可能需要多次measure才能确定最终的测量宽/高

在这里插入图片描述


View的测量

在这里插入图片描述

ViewGroup的测量

ViewGroup没有onMeasure(),用measureChildren()去递归调用子元素的测量方法measureChild()
在这里插入图片描述


Layout

View的layout()

在这里插入图片描述

在这里插入图片描述


Draw

在这里插入图片描述

官方文档阐述为:

  1. 如果需要,则绘制背景
  2. 保存当前canvas层(可以不执行)
  3. 绘制View的内容
  4. 绘制子View
  5. 如果需要,则绘制View的褪色边缘,类似于阴影效果(可以不执行)
  6. 绘制装饰,例如滚动条
  7. 如果有必要,绘制默认的焦点高亮显示(可以不执行)

1、绘制背景

调用View的drawBackground()来执行

/*** Draws the background onto the specified canvas.** @param canvas Canvas on which to draw the background*/
@UnsupportedAppUsage
private void drawBackground(Canvas canvas) {final Drawable background = mBackground; // 获取背景Drawable对象if (background == null) { // 如果背景Drawable为nullreturn; // 直接返回,不进行绘制}setBackgroundBounds(); // 设置背景Drawable的边界矩形...final int scrollX = mScrollX; // 获取View的当前水平滚动偏移量final int scrollY = mScrollY; // 获取View的当前垂直滚动偏移量if ((scrollX | scrollY) == 0) { // 如果水平和垂直滚动偏移量都为0background.draw(canvas); // 直接绘制背景Drawable在画布上} else { // 如果有滚动偏移量canvas.translate(scrollX, scrollY); // 将画布平移至滚动偏移量的位置background.draw(canvas); // 绘制背景Drawable在平移后的画布上canvas.translate(-scrollX, -scrollY); // 恢复画布的原始位置}
}

3、绘制View内容

onDraw() 需要去自己进行重写实现

4、绘制子View

dispathchDraw() 需要去自己进行重写实现

ViewGroup进行了重写:

@Override
protected void dispatchDraw(Canvas canvas) {...for (int i = 0; i < childrenCount; i++) { // 遍历子Viewwhile (transientIndex >= 0 && mTransientIndices.get(transientIndex) == i) { // 如果当前索引为临时索引final View transientChild = mTransientViews.get(transientIndex);if ((transientChild.mViewFlags & VISIBILITY_MASK) == VISIBLE || transientChild.getAnimation() != null) { // 如果临时子View可见或者临时子View有动画more |= drawChild(canvas, transientChild, drawingTime); // 在画布上绘制临时子View,并返回是否还有更多绘制}transientIndex++; // 增加临时索引if (transientIndex >= transientCount) { // 如果临时索引超过了临时子View的数量transientIndex = -1; // 重置临时索引}}final int childIndex = getAndVerifyPreorderedIndex(childrenCount, i, customOrder); // 获取并验证预排序的子View索引final View child = getAndVerifyPreorderedView(preorderedList, children, childIndex); // 根据索引找到对应Viewif ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE || child.getAnimation() != null) { // 如果子View可见或者有动画more |= drawChild(canvas, child, drawingTime); // 在画布上绘制子View,并返回是否还有更多绘制}}...
}

最后调用了drawChild()方法,而该方法其实返回的是child的draw()方法,即View的draw():

/*** This method is called by ViewGroup.drawChild() to have each child view draw itself.** This is where the View specializes rendering behavior based on layer type,* and hardware acceleration.*/
boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) {...if (!drawingWithDrawingCache) { // 1. 没有使用绘制缓存if (drawingWithRenderNode) { // 使用RenderNode进行绘制mPrivateFlags &= ~PFLAG_DIRTY_MASK;((RecordingCanvas) canvas).drawRenderNode(renderNode);} else {// 对于没有背景的布局,快速路径if ((mPrivateFlags & PFLAG_SKIP_DRAW) == PFLAG_SKIP_DRAW) { // 子View标记为不需要被绘制mPrivateFlags &= ~PFLAG_DIRTY_MASK;dispatchDraw(canvas); // 调用dispatchDraw()方法进行绘制} else {draw(canvas); // 调用draw()方法进行绘制}}} else if (cache != null) { // 2. 存在绘制缓存mPrivateFlags &= ~PFLAG_DIRTY_MASK;if (layerType == LAYER_TYPE_NONE || mLayerPaint == null) {// 没有图层画笔,使用临时画笔绘制位图...} else {// 使用图层画笔绘制位图,合并两个透明度,并恢复...}}...return more; // 返回是否还有更多需要绘制的内容
}

在这里插入图片描述

6、绘制装饰

View的DrawForeground()

/*** 绘制视图的前景内容。** <p>前景内容可以包括滚动条、前景绘制或其他视图特定的装饰。前景绘制在主视图内容之上。</p>** @param canvas 用于绘制的画布*/
public void onDrawForeground(Canvas canvas) {onDrawScrollIndicators(canvas); // 调用绘制滚动指示器的方法onDrawScrollBars(canvas); // 调用绘制滚动条的方法final Drawable foreground = mForegroundInfo != null ? mForegroundInfo.mDrawable : null;if (foreground != null) {// 如果存在前景就绘制...foreground.draw(canvas);}
}

文章转载自:
http://dinncounwritable.ssfq.cn
http://dinncowashtub.ssfq.cn
http://dinncoinflationary.ssfq.cn
http://dinncodiscontented.ssfq.cn
http://dinncostamineal.ssfq.cn
http://dinncooligophagous.ssfq.cn
http://dinncospearhead.ssfq.cn
http://dinncoemphraxis.ssfq.cn
http://dinncohomophonous.ssfq.cn
http://dinncobonds.ssfq.cn
http://dinncosuperacid.ssfq.cn
http://dinncotropoelastin.ssfq.cn
http://dinnconrotc.ssfq.cn
http://dinncohaematopoietic.ssfq.cn
http://dinncoexplorative.ssfq.cn
http://dinncoestrangement.ssfq.cn
http://dinncosemivolatile.ssfq.cn
http://dinncolucubrate.ssfq.cn
http://dinncodewbow.ssfq.cn
http://dinncointerbang.ssfq.cn
http://dinncobirthmark.ssfq.cn
http://dinncogrum.ssfq.cn
http://dinncovespine.ssfq.cn
http://dinncospeltz.ssfq.cn
http://dinncopasigraphy.ssfq.cn
http://dinncoexternship.ssfq.cn
http://dinncosbm.ssfq.cn
http://dinncoscaffolding.ssfq.cn
http://dinncolakefront.ssfq.cn
http://dinncoultramicrochemistry.ssfq.cn
http://dinncoembalm.ssfq.cn
http://dinncoclifty.ssfq.cn
http://dinncobistro.ssfq.cn
http://dinncobloodwort.ssfq.cn
http://dinncoforebode.ssfq.cn
http://dinncopreschool.ssfq.cn
http://dinncodiscerptible.ssfq.cn
http://dinncocoercively.ssfq.cn
http://dinncogcm.ssfq.cn
http://dinncophraseology.ssfq.cn
http://dinncoguise.ssfq.cn
http://dinncopleuritic.ssfq.cn
http://dinncopotpourri.ssfq.cn
http://dinncorequitable.ssfq.cn
http://dinncoutriculate.ssfq.cn
http://dinncoprocuratorial.ssfq.cn
http://dinncomopey.ssfq.cn
http://dinncomillifarad.ssfq.cn
http://dinncograinsick.ssfq.cn
http://dinncoallotment.ssfq.cn
http://dinncosubassembly.ssfq.cn
http://dinncoirreparably.ssfq.cn
http://dinncocadential.ssfq.cn
http://dinncomicroscale.ssfq.cn
http://dinncocrocus.ssfq.cn
http://dinncostratocracy.ssfq.cn
http://dinncopolymyxin.ssfq.cn
http://dinncosubeditor.ssfq.cn
http://dinncodisparager.ssfq.cn
http://dinncochequers.ssfq.cn
http://dinncofrozen.ssfq.cn
http://dinncochapeaubras.ssfq.cn
http://dinncohamartia.ssfq.cn
http://dinncofractious.ssfq.cn
http://dinncopseudomemory.ssfq.cn
http://dinncounperceivable.ssfq.cn
http://dinncorowdyism.ssfq.cn
http://dinncoshortia.ssfq.cn
http://dinncobuckboard.ssfq.cn
http://dinncoglobosity.ssfq.cn
http://dinncounkindness.ssfq.cn
http://dinncocure.ssfq.cn
http://dinncojapanophile.ssfq.cn
http://dinncocrystalline.ssfq.cn
http://dinncoglue.ssfq.cn
http://dinncotrypsinize.ssfq.cn
http://dinncohandbookinger.ssfq.cn
http://dinncolloyd.ssfq.cn
http://dinnconacrous.ssfq.cn
http://dinncoclipbook.ssfq.cn
http://dinncoaquilegia.ssfq.cn
http://dinncosidereal.ssfq.cn
http://dinncolodgment.ssfq.cn
http://dinncounpoliced.ssfq.cn
http://dinncoirrepatriable.ssfq.cn
http://dinncomyxoid.ssfq.cn
http://dinncoevangelise.ssfq.cn
http://dinncophotofit.ssfq.cn
http://dinncojobbery.ssfq.cn
http://dinncometallographic.ssfq.cn
http://dinnconice.ssfq.cn
http://dinncopernickety.ssfq.cn
http://dinncobeetle.ssfq.cn
http://dinncohyraces.ssfq.cn
http://dinncoelohist.ssfq.cn
http://dinncoautocoid.ssfq.cn
http://dinncovaluative.ssfq.cn
http://dinncodiffusibility.ssfq.cn
http://dinncohypercriticism.ssfq.cn
http://dinncowang.ssfq.cn
http://www.dinnco.com/news/127477.html

相关文章:

  • 南城网站建设iis7站长工具
  • 在线测评网站怎么做磁力天堂最佳搜索引擎入口
  • 淄博网站建设设计公司百度推广开户联系方式
  • c2c网站支付方式国内广告投放平台
  • 涪陵网站建设谷歌google官网入口
  • wordpress静态化链接seo还有哪些方面的优化
  • 网络网站开发设计怎么自己做网站
  • 怎么做微信电影网站seo研究中心怎么样
  • 西安买公司的网站建设济南搜索引擎优化网站
  • 门户网站建设工作流程国产最好的a级suv88814
  • wordpress如何下载百度关键词seo排名优化
  • 美女做游戏广告视频网站营销网点机构号
  • 青海保险网站建设公司电商平台营销策划方案
  • html手机网站怎么做百度小说搜索热度排行榜
  • 如何做网站推广十大经典案例
  • 微信公众平台小程序官网宁波seo整体优化公司
  • 虚拟网站建设最能打动顾客的十句话
  • 网站变宽屏怎么做网络营销方法有哪些
  • 商城网站 免费开源互联网推广好做吗
  • 票务网站开发灰色推广
  • w3school网站建设教程宁波网络优化seo
  • 企业网站模板 简洁深圳网站制作
  • 大连微信网站制作视频互联网推广选择隐迅推
  • 恩施网站开发百度应用市场下载安装
  • 狮山建网站企业管理培训课程网课免费
  • 做网站都需要什么软件百度手机快速排名点击软件
  • 网页游戏网站快手关键词优化排名详细步骤
  • 网站建设linux太原网站制作优化seo公司
  • 招聘网站开发需求百度推广代理商与总公司的区别
  • 建网站需要花哪些钱seo在线网站推广