Got it!
圖像的分辨率並不重要!真正。 重要的是確保圖像標籤通過自動調整圖像大小來顯示完整的圖像。
方法如下:
- 定義與specfied高度(window.innerHeight)和寬度(window.innerWidth)DIV標記。
- 將img標記作爲DIV標記的子元素(高度= 100%,寬度= 100%)
不考慮圖像的分辨率,設備的分辨率,圖像的設備的屏幕大小始終自動調整大小並以全尺寸顯示。
完整的代碼,以使傳送帶的工作是在這裏:
旋轉木馬代碼
{
xtype: 'panel'
layout: 'fit',
flex: Ext.os.is.Phone ? 5 : 6,
items: [
{
xtype: 'carousel',
direction: 'horizontal',
directionLock: true,
id: 'ImgId',
flex: Ext.os.is.Phone ? 5 : 6,
config: {
fullscreen: true
}
}
]
}
旋轉木馬項目代碼
Ext.each(images, function (picture) {
var img = picture.url;
var bigImg = picture.bigUrl;
itemsoverlay.push({
xtype: 'label',
html: '<div style="width:'
+ window.innerWidth
+ 'px;height:' + 'px;"><img src='
+ imgURL
+ ' style="width: 100%;height: 100%;" /></div>'
});
});
此代碼適用於平板電腦和智能手機,iOS或Android。
HTH
如果我將圖像的高度/寬度設置爲100% - 它會拉伸圖像。我需要保持實際的圖像大小比例 - 所以它不會真正幫助我的情況:( – Aajahid