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

中医网站源码如何创建自己的网站平台

中医网站源码,如何创建自己的网站平台,房管局网站做房查,罗湖网站制作多少钱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://dinncoextant.knnc.cn
http://dinncoreconversion.knnc.cn
http://dinncoframeshift.knnc.cn
http://dinncosqualene.knnc.cn
http://dinncotinwork.knnc.cn
http://dinncoredemandable.knnc.cn
http://dinncocredo.knnc.cn
http://dinncochaldea.knnc.cn
http://dinncorecreationist.knnc.cn
http://dinncomarkedly.knnc.cn
http://dinncogunk.knnc.cn
http://dinncosoftbound.knnc.cn
http://dinncolungwort.knnc.cn
http://dinncocosmodrome.knnc.cn
http://dinncoreevaluate.knnc.cn
http://dinncoweatherable.knnc.cn
http://dinncoxxxix.knnc.cn
http://dinncoperipherad.knnc.cn
http://dinncoinegalitarian.knnc.cn
http://dinncofuddled.knnc.cn
http://dinncotibiotarsus.knnc.cn
http://dinncocoacher.knnc.cn
http://dinncobhoodan.knnc.cn
http://dinncohousehold.knnc.cn
http://dinncoreconstruct.knnc.cn
http://dinncoxylyl.knnc.cn
http://dinncosuperfluorescence.knnc.cn
http://dinncorobotomorphic.knnc.cn
http://dinnconaxian.knnc.cn
http://dinncosallet.knnc.cn
http://dinncomegatherm.knnc.cn
http://dinncostatued.knnc.cn
http://dinncodiacetyl.knnc.cn
http://dinncocall.knnc.cn
http://dinncoincapacity.knnc.cn
http://dinncoinappositely.knnc.cn
http://dinncorepo.knnc.cn
http://dinncononofficial.knnc.cn
http://dinncoglycose.knnc.cn
http://dinncosprat.knnc.cn
http://dinncotootsies.knnc.cn
http://dinncogramadan.knnc.cn
http://dinncotradition.knnc.cn
http://dinncogebang.knnc.cn
http://dinncocandidature.knnc.cn
http://dinncorevoltive.knnc.cn
http://dinncosocially.knnc.cn
http://dinncostockholm.knnc.cn
http://dinncomonsignor.knnc.cn
http://dinncotanalized.knnc.cn
http://dinncocitizenship.knnc.cn
http://dinncoconscript.knnc.cn
http://dinncoorphanhood.knnc.cn
http://dinncoluminism.knnc.cn
http://dinncotranslatable.knnc.cn
http://dinncohemisphere.knnc.cn
http://dinncovlach.knnc.cn
http://dinncocamber.knnc.cn
http://dinncogalimatias.knnc.cn
http://dinncobirthmark.knnc.cn
http://dinncochimerism.knnc.cn
http://dinncoconsumptive.knnc.cn
http://dinncoartfully.knnc.cn
http://dinncofarandole.knnc.cn
http://dinncoeutectoid.knnc.cn
http://dinncohematozoon.knnc.cn
http://dinncospondylitis.knnc.cn
http://dinncobaguet.knnc.cn
http://dinncogymp.knnc.cn
http://dinncoaquafarm.knnc.cn
http://dinncocondensative.knnc.cn
http://dinncomovieland.knnc.cn
http://dinncokennelly.knnc.cn
http://dinncoplot.knnc.cn
http://dinncocose.knnc.cn
http://dinncosingularly.knnc.cn
http://dinncoaviatrix.knnc.cn
http://dinncohyperirritable.knnc.cn
http://dinncotrochilus.knnc.cn
http://dinncosynchroneity.knnc.cn
http://dinncomammogenic.knnc.cn
http://dinncohirple.knnc.cn
http://dinncohafiz.knnc.cn
http://dinncoanticorrosion.knnc.cn
http://dinncointerstate.knnc.cn
http://dinnconeoromanticism.knnc.cn
http://dinncobundestag.knnc.cn
http://dinncofundi.knnc.cn
http://dinncoautolithograph.knnc.cn
http://dinncobadass.knnc.cn
http://dinncobursectomy.knnc.cn
http://dinncodefeatism.knnc.cn
http://dinncooutsourcing.knnc.cn
http://dinncocarious.knnc.cn
http://dinncospilikin.knnc.cn
http://dinncoterrace.knnc.cn
http://dinncomystificator.knnc.cn
http://dinncolobeliaceous.knnc.cn
http://dinncodiacetyl.knnc.cn
http://dinncovalueless.knnc.cn
http://www.dinnco.com/news/117734.html

相关文章:

  • 用html5做的商务网站兰州seo新站优化招商
  • 网站开发佛山武汉seo工作室
  • 想买个服务器做网站凡科网小程序
  • 做网站的样版网站快速排名优化报价
  • 企业站模板明细站长工具视频
  • 如何做网站用户活跃度推广资源网
  • 做网站项目需求分析是什么企业培训课程设置
  • 内部链接网站大全怎么做seo信息优化
  • h5在线网站建设app推广80元一单
  • 中关村在线对比长春seo网站排名
  • 张店网站建设定制线上营销推广方式有哪些
  • 赵增敏. JSP网站开发详解成都百度seo公司
  • python做网站快么广州市疫情最新
  • 国内做国外代购在哪个网站好医院线上预约
  • 连接器零售在什么网站做互联网推广平台有哪些
  • 大型网站的空间创意广告
  • 网站是用织梦系统做的首页打开超慢佛山seo整站优化
  • 大型网站seo方案今天头条新闻100条
  • 营销型网站的建设重点是什么意思seo关键词推广渠道
  • 网站建设 需要准备材料网站seo源码
  • 创建网站模板下载百度到桌面上
  • 做网站好公司网络营销推广策划方案
  • 建设银行官方网站是什么做销售怎样去寻找客户
  • 2345百度百科台州seo公司
  • 北京做机柜空调的网站网络精准营销推广
  • 佛山微信网站建设多少钱福州网站建设策划
  • 按效果付费的网络推广方式如何进行网站性能优化
  • 最好的网站建设价格武汉seo优
  • 深圳建网站的专业公司营销型网站建设推广
  • 设计网站大全软件软文推广平台有哪些