1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    35
    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,071
    Answers
    24
    Vote Rating
    40
    dawesi has a spectacular aura about dawesi has a spectacular aura about

      0  

    Default


    what are the image dimensions?
    Senior Technical Training & Mentoring

    Teahouse Training Company
    Asia Pacific Region (Official Certified Sencha Trainer)

    Check out SenchaWorld.com - The best bits from the Sencha community (videos, blogs, etc)

    Code Validation : JSLint | JSONLint | JSONPLint

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    35
    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
    35
    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

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar