If you use ImageView in your android app layout and you get that unwanted padding around the image, here’s an Android XML attribute that helped me solved the layout issue:
|
|
<ImageView (...) android:adjustViewBounds=“true” /> |
Add android:adjustViewBounds="true" attribute to your ImageView XML tag and you’ll probably see the unwanted padding go away.
According to the ImageView docs:
android:adjustViewBounds
Set this to true if you want the ImageView to adjust its bounds to preserve the aspect ratio of its drawable.
You might also want to check the related Java method: setAdjustViewBounds(boolean)
Related Posts
The homo sapiens behind these blog posts is “Catzie“
An odd human being who happens to have a variety of ever-changing interests, but these days she is often caught coding (Web and Android App Developer for a total of 14+ years!), optimizing this blog, tweaking a Traveler’s Notebook, refilling a cheap fountain pen, making up silly song/rap lyrics, watching K-pop performances, concocting unusual dessert/drink flavors, making scented candles, drawing, painting water-based mixed media pieces, obsessing about how some things works and what unfamiliar words mean, automating repetitive chores, anime, video games… Ran online dessert shops Cookies PH and Catzie’s Cakery in her past life.