-
20 Feb 2013 5:16 PM #1
Unanswered: img too wide in android
Unanswered: img too wide in android
Hi,
I need some help on this one. It's killing me.
I'm trying to display an image in my app. I'm using xtype : 'image' in a vbox. it works fine in Chrome, even when I resize the window, the image resize. no worries.
Then I build in native for android. On the phone, galaxy S3 level 16, the picture is too wide in portrait mode. the picture fill the height, cutting off the side. when I rotate in landscape, it's ok.
Any idea why? thanks.
note: the viewport only have 'main' .
Code:Ext.define('JAM.view.Main', { extend: 'Ext.Container', xtype: 'main', requires: [ 'Ext.TitleBar', 'Ext.Img' ], config: { layout: 'vbox', items: [ { docked: 'top', xtype: 'titlebar', title: 'Navigation', }, { xtype: 'image', src : 'resources/images/sticker.png', flex: 1 } ] } });
-
21 Feb 2013 4:25 AM #2Sencha - Sales Team
- Join Date
- Mar 2007
- Location
- Melbourne, Australia (aka GMT+10)
- Posts
- 738
- Vote Rating
- 6
- Answers
- 10
what are the image dimensions?
Check out SenchaWorld.com for articles, screencasts, conference videos and more.
Sencha Technical Training : Asia Pacific Region
Code Validation : JSLint | JSONLint | JSONPLint
-
22 Feb 2013 6:02 AM #3
the image is 240 x 225.
I have found in the default CSS the following:
I'm not sure but this means that height is always 100%?Code:.x-img.x-img-image img { width: auto; height: 100%; } .x-img.x-img-background { background-repeat: no-repeat; background-position: center; background-size: auto 100%; }
Is it possible to code in css something like:
(background-size: auto 100%) AND (maxwidth = 100% )
not sure how to code that bit. Cheers
-
22 Feb 2013 6:16 AM #4
Set the height of the image to "auto".
Vote it up if I have helped you! (or pay me a cup of
)
-
23 Feb 2013 6:02 PM #5
If I set the height to auto, the image is not maximise on the screen.
-
25 Feb 2013 4:31 AM #6
It doesn't make sense since the width is auto, and it is working.... =s
Vote it up if I have helped you! (or pay me a cup of
)


Reply With Quote


