question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ImageView w/ scale: image position inconsistent between iOS and Android (v1.10)

See original GitHub issue

I’m trying to create an animation where the image is much wider than the viewport and using translateX we pan the image through the viewport (from left: 0 to a negative left offset). Works great on iOS where it draws the image starting from top/left, but on Android it draws the image as if it’s center X, like so:

tabris-issue

The area to the left is just getting cropped on Android. (Even if I try moving the ImageView to the right with a positive left offset, it doesn’t reveal more of the image — just cropped)

Code is basically this:

background = new tabris.ImageView({
    image: {
        src: "image.jpg",
    },
    scaleMode: "fill",
    layoutData: {
        top: 0,
        bottom: 0,
        left:  0,
        width: computedBackgroundImageWidth
    }
}).appendTo(rootComposite);

background.animate({
    transform: {
        translationX: (computedBackgroundImageWidth - screen.width) * -1
    }
}, {
    delay: 0,
    duration: 40000,
    repeat: 1000,
    reverse: true,
    easing: "linear"
});

Thanks!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
patbenatarcommented, Mar 17, 2017

This is great, thanks! The NavigationView was my biggest worry but it looks like there’s an easy polyfill for that. Cheers.

0reactions
mpostcommented, Jun 14, 2017

Closing this issue as resolved. Please reopen of you have any more problems.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scale Image to fill ImageView width and keep aspect ratio
It doesn't matter if you use android:src or ImageView. ... To create an image with width equals screen width, and height proportionally set...
Read more >
Working with the ImageView | CodePath Android Cliffnotes
The ImageView handles all the loading and scaling of the image for you. Note the scaleType attribute which defines how the images will...
Read more >
Inconsistent SymbolLayer icon rendering when running from ...
Android : icon size seem consistent all the time (doesn't render at original size but I don't want this issue to be about...
Read more >
ImageView.ScaleType - Android Developers
Center the image in the view, but perform no scaling. ImageView.ScaleType, CENTER_CROP. Scale the image uniformly (maintain the image's aspect ratio) so ...
Read more >
Building a splash screen in React Native - LogRocket Blog
Learn how to build a splash screen in React Native for both iOS and Android apps, and edit its features, like background color....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found