大佬教程收集整理的这篇文章主要介绍了android-layout – match_parent不填充父级!,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
LinearLayout mainRowLayout = new LinearLayout(this); mainRowLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT)); TableRow tr = new TableRow(this); tr.addView(mainRowLayout);
问题是LinearLayout没有填充父级(这是TableRow).
附图说明了问题,如Android的hirarchyViewer(绿色矩形是我的标记)所示.
谢谢.
// child element LinearLayout mainRowLayout = new LinearLayout(this); // parent element TableRow tr = new TableRow(this); // parent element's instructions (layout params for main row) TableRow.LayoutParams lopForMainRow = new TableRow.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT); tr.addView(mainRowLayout,lopForMainRow);
搏一搏 :]
以上是大佬教程为你收集整理的android-layout – match_parent不填充父级!全部内容,希望文章能够帮你解决android-layout – match_parent不填充父级!所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。