Android中动态更新View组件的大小
2707 点击·0 回帖
![]() | ![]() | |
![]() | 有时为了适配机型,我们需要动态更新组件的大小,为了达到在不同机型同样的效果。 通过设置LayoutParams就可以达到这个效果。 [java] ImageView pictureView = (ImageView) convertView.findViewById(R.id.picture_view); ViewGroup.LayoutParams layoutParams=holder.picture.getLayoutParams(); layoutParams.width = 1024; layoutParams.height = 768; pictureView.setLayoutParams(layoutParams); | |
![]() | ![]() |