View.getWidth()和View.getHeight()为0的根本原因是控件还没有完成绘制,你必须等待系统将绘制完View时才能获得。
@Overridepublic void onWindowFocusChanged(boolean hasFocus) {super.onWindowFocusChanged(hasFocus);if (hasFocus){int width = this.getMeasuredWidth();int height = this.getMeasuredHeight();}}
- 版权所有:奇站网络 转载请注明出处
- 厦门奇站网络科技有限公司,专业提供网站建设,响应式网站建设,小程序开发,系统定制开发。
- 软件开发咨询热线:吴小姐 13313868605
