Egret learning diary entry --- twenty-seventh piece (book section 9.18.4 ~ 9.18.6 Content)

Twenty-seventh piece (9.18.4 - 9.18.6 book section)

  it is good! Section 9.18.4 begin.

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  Focus (focus then yesterday, it is the focus of 4):

    4, a data source List component.

    5, through the code, provided List component binding skin.

    6, the vertical layout List component, a grid layout.

  operating:

    4, a data source List component.

      A first, common array of strings.

      

      Second, array object form. This form of words, to match the specified skin.

      

      Third, custom class presentation.

      

    5, through the code, provided List component binding skin.

      first step:

        Ready material.

        

        Create a ArmorItemRenderSkin.exml file.

        

        Set up a data source field.

        

      Step two:

        Creating a class association.

        

      third step:

        Changes made before the ScrollerAndList class, let the data provided externally.

        

       the fourth step:

        Creating a data item class.

        

      the fifth step:

        ScrollerAndList class started, and set the data source and ArmorItemRender skin.

        

        Run to see the effect.

        

    6, the vertical layout List component, a grid layout.

      A first, vertical layout

        layout.gap = 15;

        Vertical spacing 15 of each item.

        

        layout.horizontalAlign = eui.JustifyAlign.JUSTIFY;

        Both ends of the width of each adaptation.  

        

      Second, grid layout.

        layout.requestedColumnCount = 3; 

        Provisions can only have a maximum of three

        

        layout.columnAlign = eui.ColumnAlign.JUSTIFY_USING_WIDTH

        So that the average width of each column.

        

  At this point, the contents of the end section 9.18.

 

  Call ~ The List component is quite long.

  今天我弄了半天了,发现EXML文件里,像是 Label组件的text属性啊,按钮的Label属性啊,Image组件的source属性啊,不能动态的设置。

  如果可以动态的设置的话,我就可以在后期自定义类里,随便设置什么{data.xxx}的了。

  Egret好像不允许这样,反正如果要用到数据源字段的话。就要在EXML文件里,提前写好 Label组件的text属性,比如{data.name}什么的。

  好了,今天就到这里吧。

Guess you like

Origin www.cnblogs.com/dmc-nero/p/11302391.html