1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    43
    Answers
    1
    Vote Rating
    0
    fatfly is on a distinguished road

      0  

    Default 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
                    }
                    ]
                }
    });

  2. #2
    Sencha Premium Member dawesi's Avatar
    Join Date
    Mar 2007
    Location
    Melbourne, Australia (aka GMT+10)
    Posts
    1,083
    Answers
    24
    Vote Rating
    44
    dawesi has a spectacular aura about dawesi has a spectacular aura about

      0  

    Default


    what are the image dimensions?
    Teahouse Training Company
    Official Certified Sencha Trainer

    Australia / New Zealand / Singapore / Hong Kong & APAC



    SenchaWorld.com - Sencha webinars, videos, etc
    SenchaForge.org - (coming soon)
    TeahouseHQ.com - Sencha ecosystem training portal

    Code Validation : JSLint | JSONLint | JSONPLint

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    43
    Answers
    1
    Vote Rating
    0
    fatfly is on a distinguished road

      0  

    Default


    the image is 240 x 225.

    I have found in the default CSS the following:

    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%;
    }
    I'm not sure but this means that height is always 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

  4. #4
    Sencha User xereta's Avatar
    Join Date
    Jul 2012
    Location
    Brazil
    Posts
    23
    Vote Rating
    0
    xereta is on a distinguished road

      0  

    Default


    Set the height of the image to "auto".
    Vote it up if I have helped you! (or pay me a cup of )

  5. #5
    Sencha User
    Join Date
    Oct 2012
    Posts
    43
    Answers
    1
    Vote Rating
    0
    fatfly is on a distinguished road

      0  

    Default


    If I set the height to auto, the image is not maximise on the screen.

  6. #6
    Sencha User xereta's Avatar
    Join Date
    Jul 2012
    Location
    Brazil
    Posts
    23
    Vote Rating
    0
    xereta is on a distinguished road

      0  

    Default


    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 )

Thread Participants: 2

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi