Android dynamically changes the component size. android Components
Note: to change the component, set it to warp_content in XML. For example:
If you want to change the width of a button, set its layout_width to wrap_content in xml.
In the code, you can dynamically set the width by setting 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 interview questions Video Explanation
Dynamically set the widget size? Android
For example, a button is in a LinearLayout.
So
B. setLayoutParams (new LinearLayout. LayoutParams (10, 10 ));
The unit of d is pixel.
How does the android control dynamically change the location and size as the screen size of the mobile phone varies?
Weight is the proportion. All weight is the total size.