sencha Carousel panel sethtml 出界的解决方案

在sencha touch 的Carousel 中 item设定为panel ,在panel上setHtml()文字

发现每页的文字都会出格,而且跟其他页面在边缘上混淆,很是苦恼

开始实验调整

 margin:'10 50 10 15',
 padding:'10 50 10 15',

发现很多边缘文字被割掉了

后来设定

panel 的width ,还是不能解决问题


最后想到的法子是在panel下面再加一个panel B,并且让B的width=屏幕的宽度,完美解决

 {
                            xtype:'panel',
                            scrollable:{
                                direction:'vertical',
                                directionLock:true
                            },
                            items:{
                                xtype:'panel',
                                //width:'320px',
                                style:'font: 12px Arial black',
                                margin:'10 50 10 15',
                                padding:'10 50 10 15',
                                itemId:'text'
                            }
                        }

////////////////

 store.load(function (records, operation, success) {
                    this.down('#text').setWidth(Ext.getBody().getSize().width);
                    this.down('#text').setHtml(records[0].get('content'));
                })


你们感受下~

你可能感兴趣的:(sencha Carousel panel sethtml 出界的解决方案)