Recently encountered a demand, the requirement is not aware of the picture width and height of the case, let the picture in the specified width, while highly adaptive, in the network to find a bit, there are many solutions, and then for their own application, chose a modified smaller scheme, and finally proved that the effect is pretty good, recorded here, Hope to help people with the same needs.
First, you need to add android:adjustviewbounds= "true" to your ImageView layout
< ImageView Android:id = "@+id/iv_custom_showdress_item_dress" android:layout_width= "Fill_parent" android:layout_height= "Wrap_ Content " android:adjustviewbounds=" true "/>
Then, set the ImageView in the code. Maximum width and maximum height, because the Adjustviewbounds property only works if the maximum height and maximum width are set
WindowManager wm = (WindowManager) _context.getsystemservice (context.window_service); int screenwidth = wm.getdefaultdisplay (). getwidth (); = viewHolder.showDress.getLayoutParams (); = screenwidth; = layoutparams.wrap_content; VIEWHOLDER.SHOWDRESS.SETLAYOUTPARAMS (LP);
Android ImageView width setting, highly adaptive