android自定义viewGroup 不显示问题

来源:互联网 发布:300英雄淘宝店 编辑:程序博客网 时间:2024/05/29 00:30

最近学习android自定义viewgroup,花了很多时间来处理,真的真的非常难找,特此记录

setMeasuredDimension((widthMode == MeasureSpec.EXACTLY ? sizeWidth : width), (heightMode == MeasureSpec.EXACTLY ? sizeHeight : height));

上面的代码能正常显示

setMeasuredDimension((widthMode == MeasureSpec.AT_MOST ? width : sizeWidth), (heightMode == MeasureSpec.EXACTLY ? height : sizeHeight));

上面的代码显示异常,自定义viewGroup不显示

字段说明

字段 说明 sizeWidth measureSpec中的宽度 width 自己测量的宽度 sizeHeight measureSpec中的高度 height 自己测量的高度

暂时还没弄懂时为什么,后续记录

0 0