Exemple #1
0
    //-------∽-★-∽------∽-★-∽--------∽-★-∽ListView∽-★-∽--------∽-★-∽------∽-★-∽--------//


    void ShowListView()
    {
        GameObject container = GameObjUtil.FindChild(m_scrollViewItemList.gameObject, "Image_mask/Container_content");

        List <int> datas = new List <int>();
        int        num   = 10;

        for (int i = 0; i < num; ++i)
        {
            datas.Add(i);
        }

        m_listView = ComponentUtil.EnsureComponent <KListView>(container);
        m_listView.itemViewType = typeof(Item1);
        m_listView.onDataChanged.AddListener(UpdateListItem);


        LayoutParam param = m_listView.layoutParam;

        //param.padding = new Padding(20, 20, 20, 20);
        param.itemGap = new Vector2(10, 50);
        //param.divNum = 2;


        m_listView.ShowList(datas);
    }
Exemple #2
0
    //-------∽-★-∽------∽-★-∽--------∽-★-∽Layout∽-★-∽--------∽-★-∽------∽-★-∽--------//

    void ShowLayout()
    {
        LayoutParam param = new LayoutParam {
        };

        param.padding = new Padding(20, 20, 20, 20);
        param.itemGap = new Vector2(50, 50);
        param.divNum  = 2;

        GameObject itemGo    = GameObjUtil.FindChild(m_scrollViewItemList.gameObject, "Image_mask/Container_content/Container_Item");
        GameObject container = GameObjUtil.GetParent(itemGo);

        itemGo.SetActive(false);

        for (var i = 0; i < 10; ++i)
        {
            GameObject item = GameObjUtil.Instantiate(itemGo);

            item.SetActive(true);
            GameObjUtil.ChangeParent(item, container);

            LayoutUtil.LayItem(param, i, item);

            m_idx2item[i] = item;
        }
    }