[]List滚动条问题
								按照示例程序写了个list,出现两个问题:
1. list不能滚动
2. list item里的button图片显示不出来
 
item代码如下:
 
																
																																
															
														1. list不能滚动
2. list item里的button图片显示不出来
item代码如下:
(function (_super){
    function MarketItem()
    {
        MarketItem.__super.call(this);
        this.size(312, 462);
        // {id:1,name:"10金豆-测试",price:0.01,title:"10金豆-测试",desc:"测试",balance:10,gift:0,imgPath:"res\\common\\BalanceSellDlg\\xiaodou.png",hot:1,orderCount:9}
        // 背景
        var bg_image = new Laya.Image();
        bg_image.skin = "res/popupwnd/market_item_bg.png";
        bg_image.pos(0, 0);
        bg_image.size(312, 462);
        this.addChild(bg_image);
        // 金豆数
        this._goldLabel = new Laya.Label();
        this._goldLabel.color = "#FFBA00";
        var font = GameUI.GetFont("$font.marketdlg.default");
        this._goldLabel.font = font.family;
        this._goldLabel.bold = (parseInt(font.bold | 0) == 0 ? false : true);
        this._goldLabel.fontSize = parseInt(font.size);
        this._goldLabel.underline = (parseInt(font.underline | 0) == 0 ? false : true);
        this._goldLabel.align = "center";
        this._goldLabel.valign = "middle";
        this._goldLabel.pos(0, 50);
        this._goldLabel.size(312, 20);
        this.addChild(this._goldLabel);
        // 金豆图片
        this._goldImage = new Laya.Image();
        this.addChild(this._goldImage);
        // 购买按钮
        this._goldButton = new Laya.Button();
        this._goldButton.skin = "res/popupwnd/btn_buygold.png";
        this._goldButton.labelFont = font.family;
        this._goldButton.labelBold = (parseInt(font.bold | 0) == 0 ? false : true);
        this._goldButton.labelSize = parseInt(font.size);
        this._goldButton.labelColors = "#FFFFFF,#FFFFFF,#FFFFFF,#EEEEEE";
        this._goldButton.stateNum = 1;
        this._goldButton.pos(75, 350);
        this.addChild(this._goldButton);
        this.setGold = function(gold)
        {
            this._goldLabel.text = "×" + gold + "金豆";
        };
        this.setGoldImage = function(img)
        {
            this._goldImage.skin = img;
            this._goldImage.pos((312-this._goldImage.width)/2, (462-this._goldImage.height)/2);
        };
        this.setPrice = function(price)
        {
            this._goldButton.label = "RMB " + price;
        };
    }
    Laya.class(MarketItem, "xgame.marketitem", _super);
})(Laya.Box);list代码如下:var list = new Laya.List();updateitem代码如下:
list.itemRender = xgame.marketitem;
list.repeatX = 3;
list.repeatY = 1;
list.spaceX = 10;
list.hScrollBarSkin = "";
//list.vScrollBarSkin = "";
list.pos((BalanceMarketDlg.width-312*3-10*2)/2, 120);
list.selectEnable = true;
list.renderHandler = new Laya.Handler(this, UpdateMarketItem);
Laya.stage.addChild(list);
list.array = that._items;
function UpdateMarketItem(cell, index)
{
// {id:1,name:"10金豆-测试",price:0.01,title:"10金豆-测试",desc:"测试",balance:10,gift:0,imgPath:"res\\common\\BalanceSellDlg\\xiaodou.png",hot:1,orderCount:9}
cell.setGold(cell.dataSource.balance + cell.dataSource.gift);
cell.setGoldImage(cell.dataSource.imgPath);
cell.setPrice(cell.dataSource.price);
}
没有找到相关结果
									已邀请:
																	
							要回复问题请先登录


 
2 个回复
Monica - 知识达人
赞同来自:
sogetsu
赞同来自: