2025-05-23

有時為瞭適配機型,我們需要動態更新組件的大小,為瞭達到在不同機型同樣的效果。
通過設置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); 
 

摘自  wxg630815 

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *