Home > Java > javaTutorial > How to Set the Height and Width of an ImageView Programmatically?

How to Set the Height and Width of an ImageView Programmatically?

Patricia Arquette
Release: 2024-11-16 22:34:03
Original
525 people have browsed it

How to Set the Height and Width of an ImageView Programmatically?

Programmatic Setting of ImageView Dimensions

Q: How to assign the height and width of an ImageView programmatically?

A: To adjust the height of the ImageView:

imageView.getLayoutParams().height = 20;
Copy after login

Crucial Note: If altering the height after the layout has been established, it's essential to additionally invoke:

imageView.requestLayout();
Copy after login

The above is the detailed content of How to Set the Height and Width of an ImageView Programmatically?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template