mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Merge pull request #27 from NativeScript/image-rounding
Fix: Images have margin when added to Layout
This commit is contained in:
@@ -73,8 +73,8 @@ public class ImageView extends android.widget.ImageView {
|
|||||||
|
|
||||||
if (measureWidth != 0 && measureHeight != 0 && (finiteWidth || finiteHeight)) {
|
if (measureWidth != 0 && measureHeight != 0 && (finiteWidth || finiteHeight)) {
|
||||||
this.computeScaleFactor(width, height, finiteWidth, finiteHeight, measureWidth, measureHeight);
|
this.computeScaleFactor(width, height, finiteWidth, finiteHeight, measureWidth, measureHeight);
|
||||||
int resultW = (int) Math.floor(measureWidth * this.scaleW);
|
int resultW = (int) Math.round(measureWidth * this.scaleW);
|
||||||
int resultH = (int) Math.floor(measureHeight * this.scaleH);
|
int resultH = (int) Math.round(measureHeight * this.scaleH);
|
||||||
|
|
||||||
measureWidth = finiteWidth ? Math.min(resultW, width) : resultW;
|
measureWidth = finiteWidth ? Math.min(resultW, width) : resultW;
|
||||||
measureHeight = finiteHeight ? Math.min(resultH, height) : resultH;
|
measureHeight = finiteHeight ? Math.min(resultH, height) : resultH;
|
||||||
|
|||||||
Reference in New Issue
Block a user