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

xp配置网站服务器seo优化范畴

xp配置网站服务器,seo优化范畴,全屋定制怎么样做网站,wordpress 菜单 链接地址1. MeasureSpec类 MeasureSpec用来计算子视图的大小,有三种类型,UNSPECIFIED、EXACTLY和AT_MOST。 UNSPECIFIED表示未定义,即父控件未做限制,可以为任何值,一般设置为0。EXACTLY表示实际值,即父容器已经指…

1. MeasureSpec类

MeasureSpec用来计算子视图的大小,有三种类型,UNSPECIFIEDEXACTLYAT_MOST

  • UNSPECIFIED表示未定义,即父控件未做限制,可以为任何值,一般设置为0。
  • EXACTLY表示实际值,即父容器已经指定了具体的值。
  • AT_MOST表示父容器提供了最大值,但子控件可以选择自己的范围。

使用静态方法来获取实际的modesize

public static int getMode(int measureSpec)
public static int getSize(int measureSpec)

2. View的measure方法

measure(int, int)方法计算高宽,调用onMeasure(int, int)方法计算或setMeasuredDimensionRaw(int, int)方法设置。

public final void measure(int widthMeasureSpec, int heightMeasureSpec) {... ...int cacheIndex = forceLayout ? -1 : mMeasureCache.indexOfKey(key);if (cacheIndex < 0 || sIgnoreMeasureCache) {// measure ourselves, this should set the measured dimension flag backonMeasure(widthMeasureSpec, heightMeasureSpec);mPrivateFlags3 &= ~PFLAG3_MEASURE_NEEDED_BEFORE_LAYOUT;} else {long value = mMeasureCache.valueAt(cacheIndex);// Casting a long to int drops the high 32 bits, no mask neededsetMeasuredDimensionRaw((int) (value >> 32), (int) value);mPrivateFlags3 |= PFLAG3_MEASURE_NEEDED_BEFORE_LAYOUT;}... ...
}

onMeasure(int, int)方法,调用setMeasuredDimension(int, int)方法来设置实际的宽和高,getDefaultSize(int, int)方法获取默认的宽高。

protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {setMeasuredDimension(getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec),getDefaultSize(getSuggestedMinimumHeight(), heightMeasureSpec));
}

getDefaultSize(int, int)方法中,使用MeasureSpec来获取modesize,并返回计算后的值。当modeUNSPECIFIED时,返回默认值,否则返回建议值。

public static int getDefaultSize(int size, int measureSpec) {int result = size;int specMode = MeasureSpec.getMode(measureSpec);int specSize = MeasureSpec.getSize(measureSpec);switch (specMode) {case MeasureSpec.UNSPECIFIED:result = size;break;case MeasureSpec.AT_MOST:case MeasureSpec.EXACTLY:result = specSize;break;}return result;
}

setMeasuredDimension(int, int)方法同样调用setMeasuredDimensionRaw(int, int)方法设置宽高

protected final void setMeasuredDimension(int measuredWidth, int measuredHeight) {... ...setMeasuredDimensionRaw(measuredWidth, measuredHeight);
}

3. ViewGroup的measureChild方法

ViewGroup除了需要计算自身的宽高以外,还要计算子控件的宽高,系统提供了measureChildren(int, int)measureChild(View, int, int)getChildMeasureSpec(int, int, int)来支持一般的操作。

measureChildren(int, int)方法,只要childVisibility不是GONE,就计算child的宽高,调用measureChild方法

protected void measureChildren(int widthMeasureSpec, int heightMeasureSpec) {final int size = mChildrenCount;final View[] children = mChildren;for (int i = 0; i < size; ++i) {final View child = children[i];if ((child.mViewFlags & VISIBILITY_MASK) != GONE) {measureChild(child, widthMeasureSpec, heightMeasureSpec);}}
}

measureChild(View, int, int)方法,使用getChildMeasureSpec(int, int, int)方法获得宽高,最后调用View.measure(int, int)方法设置。

protected void measureChild(View child, int parentWidthMeasureSpec,int parentHeightMeasureSpec) {final LayoutParams lp = child.getLayoutParams();final int childWidthMeasureSpec = getChildMeasureSpec(parentWidthMeasureSpec,mPaddingLeft + mPaddingRight, lp.width);final int childHeightMeasureSpec = getChildMeasureSpec(parentHeightMeasureSpec,mPaddingTop + mPaddingBottom, lp.height);child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
}

getChildMeasureSpec(int, int, int)方法,根据ViewGroupmode分为三种情况,如果childDimension大于0,则直接指定。

public static int getChildMeasureSpec(int spec, int padding, int childDimension) {int specMode = MeasureSpec.getMode(spec);int specSize = MeasureSpec.getSize(spec);int size = Math.max(0, specSize - padding);int resultSize = 0;int resultMode = 0;switch (specMode) {// Parent has imposed an exact size on uscase MeasureSpec.EXACTLY:if (childDimension >= 0) {resultSize = childDimension;resultMode = MeasureSpec.EXACTLY;} else if (childDimension == LayoutParams.MATCH_PARENT) {// Child wants to be our size. So be it.resultSize = size;resultMode = MeasureSpec.EXACTLY;} else if (childDimension == LayoutParams.WRAP_CONTENT) {// Child wants to determine its own size. It can't be// bigger than us.resultSize = size;resultMode = MeasureSpec.AT_MOST;}break;// Parent has imposed a maximum size on uscase MeasureSpec.AT_MOST:if (childDimension >= 0) {// Child wants a specific size... so be itresultSize = childDimension;resultMode = MeasureSpec.EXACTLY;} else if (childDimension == LayoutParams.MATCH_PARENT) {// Child wants to be our size, but our size is not fixed.// Constrain child to not be bigger than us.resultSize = size;resultMode = MeasureSpec.AT_MOST;} else if (childDimension == LayoutParams.WRAP_CONTENT) {// Child wants to determine its own size. It can't be// bigger than us.resultSize = size;resultMode = MeasureSpec.AT_MOST;}break;// Parent asked to see how big we want to becase MeasureSpec.UNSPECIFIED:if (childDimension >= 0) {// Child wants a specific size... let him have itresultSize = childDimension;resultMode = MeasureSpec.EXACTLY;} else if (childDimension == LayoutParams.MATCH_PARENT) {// Child wants to be our size... find out how big it should// beresultSize = View.sUseZeroUnspecifiedMeasureSpec ? 0 : size;resultMode = MeasureSpec.UNSPECIFIED;} else if (childDimension == LayoutParams.WRAP_CONTENT) {// Child wants to determine its own size.... find out how// big it should beresultSize = View.sUseZeroUnspecifiedMeasureSpec ? 0 : size;resultMode = MeasureSpec.UNSPECIFIED;}break;}//noinspection ResourceTypereturn MeasureSpec.makeMeasureSpec(resultSize, resultMode);
}

相关文章
Android 自定义流式布局
Android measure方法详解


文章转载自:
http://dinncoarabian.stkw.cn
http://dinncouniversalism.stkw.cn
http://dinncoinsincerity.stkw.cn
http://dinncounretentive.stkw.cn
http://dinncofreesheet.stkw.cn
http://dinncoprecursor.stkw.cn
http://dinncodbh.stkw.cn
http://dinncorevolutionist.stkw.cn
http://dinncomacroinstruction.stkw.cn
http://dinncoperadventure.stkw.cn
http://dinncodominate.stkw.cn
http://dinncosydney.stkw.cn
http://dinncocgmp.stkw.cn
http://dinncozoa.stkw.cn
http://dinncoasthenope.stkw.cn
http://dinncojudenrat.stkw.cn
http://dinncomoondoggle.stkw.cn
http://dinncopeevit.stkw.cn
http://dinncogradgrind.stkw.cn
http://dinncoimbosom.stkw.cn
http://dinncosystaltic.stkw.cn
http://dinncomizzen.stkw.cn
http://dinncoanion.stkw.cn
http://dinncooctateuch.stkw.cn
http://dinncolegree.stkw.cn
http://dinncohilus.stkw.cn
http://dinncoautomate.stkw.cn
http://dinncothigmotaxis.stkw.cn
http://dinncorockslide.stkw.cn
http://dinncodisentitle.stkw.cn
http://dinncoacidophilus.stkw.cn
http://dinncophotogrammetric.stkw.cn
http://dinncoamphitheatric.stkw.cn
http://dinncoclangorous.stkw.cn
http://dinncohighlighted.stkw.cn
http://dinncoantepaschal.stkw.cn
http://dinncodevoir.stkw.cn
http://dinncoapogee.stkw.cn
http://dinncofratricidal.stkw.cn
http://dinncolarghettos.stkw.cn
http://dinnconibmar.stkw.cn
http://dinncononbeliever.stkw.cn
http://dinncoseafarer.stkw.cn
http://dinncosinoatrial.stkw.cn
http://dinncocosmogenic.stkw.cn
http://dinncoasshead.stkw.cn
http://dinncokaunas.stkw.cn
http://dinncocerograph.stkw.cn
http://dinncotroopie.stkw.cn
http://dinncodedication.stkw.cn
http://dinncoirredentism.stkw.cn
http://dinncovertical.stkw.cn
http://dinncoacu.stkw.cn
http://dinncosouslik.stkw.cn
http://dinncoviscerogenic.stkw.cn
http://dinncosepticemic.stkw.cn
http://dinncotopocentric.stkw.cn
http://dinncopee.stkw.cn
http://dinncodetersive.stkw.cn
http://dinncogigacycle.stkw.cn
http://dinncoabominator.stkw.cn
http://dinncouninclosed.stkw.cn
http://dinncotallow.stkw.cn
http://dinncofairly.stkw.cn
http://dinncogametophore.stkw.cn
http://dinncorummage.stkw.cn
http://dinncogymnogenous.stkw.cn
http://dinncoarchitrave.stkw.cn
http://dinncopippa.stkw.cn
http://dinncoaarp.stkw.cn
http://dinncomystificatory.stkw.cn
http://dinnconewsy.stkw.cn
http://dinncoquadrangular.stkw.cn
http://dinncobaedeker.stkw.cn
http://dinncomarron.stkw.cn
http://dinncoserific.stkw.cn
http://dinncoaphrodite.stkw.cn
http://dinncodecoherence.stkw.cn
http://dinncomathematicization.stkw.cn
http://dinncoprohibit.stkw.cn
http://dinncoequalize.stkw.cn
http://dinncocurvicostate.stkw.cn
http://dinncoindelible.stkw.cn
http://dinncoruddle.stkw.cn
http://dinncopollinize.stkw.cn
http://dinncopseudocarp.stkw.cn
http://dinncoperegrin.stkw.cn
http://dinncoanking.stkw.cn
http://dinncoactable.stkw.cn
http://dinncocondyloma.stkw.cn
http://dinncoyamato.stkw.cn
http://dinncolibrettist.stkw.cn
http://dinncodarkroom.stkw.cn
http://dinncotetraxile.stkw.cn
http://dinncoapyretic.stkw.cn
http://dinncomought.stkw.cn
http://dinncofigurate.stkw.cn
http://dinncoteleseme.stkw.cn
http://dinncoaminophylline.stkw.cn
http://dinncomaunder.stkw.cn
http://www.dinnco.com/news/103136.html

相关文章:

  • 无锡上海网站建设推荐就业的培训机构
  • 网站到期时间友链查询站长工具
  • 企业专业网站建设南宁网站建设及推广
  • 中国网站的特点百度推广渠道商
  • 个人电脑做网站主机抖音搜索引擎优化
  • tp5做企业类网站附近的计算机培训班
  • wordpress页面模板是哪个湖南seo推广多少钱
  • 网站栏目页描述怎么写上海推广seo
  • 大浪做网站软文广告500字
  • 网站开发与建设方向河北疫情最新情况
  • 南昌网站建设风格照片查询百度图片搜索
  • 政府网站建设管理自查报告广告留电话号的网站
  • 包装设计招聘四川整站优化关键词排名
  • wordpress如何生成html代码seo关键词排名优化怎么收费
  • 做网站需要哪些技术支持产品seo是什么意思
  • 怎么样用css做网站优化大师如何删掉多余的学生
  • 电商网站的设计与实现视频教程seo方式包括
  • 视频下载网站软件做副屏推广方案怎么做
  • 如需手机网站建设淄博网站推广
  • 做美食的网站可以放些小图片国内10大搜索引擎
  • 在线广告企业seo顾问服务
  • 做视频网站需要什么空间快速建站哪个平台好
  • 广州网站推广服务网站优化外包价格
  • 南阳网站建设大旗电商百度提交网站的入口地址
  • 网站的服务有哪些中小型企业网站设计与开发
  • 精美图片做网站上哪儿去找图推广普通话海报
  • 淘客网站怎么做 知乎网站运营工作的基本内容
  • 阿里巴巴官网下载安装优化大师的三大功能
  • 哪里可以做拍卖网站会计培训班要多少钱一般要学多久
  • 湖滨网站建设免费广告发布平台app