Android 动态改变组件大小

时间:2014-10-28 12:10:30   收藏:0   阅读:354

注意,你要改变组件的部分,要在XML中将其设置为warp_content.比如

你如果要改变button宽度,在xml中就要将其layout_width设置为wrap_content


在代码中动态设置宽度是通过设置设置LayoutParams来达到效果的

ImageView pictureView = (ImageView) convertView.findViewById(R.id.picture_view); 
ViewGroup.LayoutParams layoutParams=holder.picture.getLayoutParams(); 
layoutParams.width = 1024; 
layoutParams.height = 768; 
pictureView.setLayoutParams(layoutParams); 

android面试题视频讲解


原文:http://blog.csdn.net/howlaa/article/details/40538091

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!