ImageView w/ scale: image position inconsistent between iOS and Android (v1.10)
See original GitHub issueI’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:
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:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is great, thanks! The NavigationView was my biggest worry but it looks like there’s an easy polyfill for that. Cheers.
Closing this issue as resolved. Please reopen of you have any more problems.