1 Star 1 Fork 0

Archermind-TI / coolMenu

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 1.88 KB
一键复制 编辑 原始数据 按行查看 历史
Hou Peidong 提交于 2021-11-18 10:33 . Initial

coolMenu

coolMenu 通过菜单方式切换Fraction

演示效果

集成

With gradle:

dependencies {
   compile 'com.gitee.archermind-ti:coolMenu:1.0.0'
}

使用方式

布局文件

<?xml version="1.0" encoding="utf-8"?>
<DirectionalLayout
    xmlns:ohos="http://schemas.huawei.com/res/ohos"
    xmlns:app="http://schemas.huawei.com/apk/res/ohos"
    ohos:height="match_parent"
    ohos:width="match_parent"
    ohos:alignment="center"
    ohos:background_element="black"
    ohos:orientation="vertical">

    <com.dxtt.coolmenu.CoolMenuFrameLayout
        ohos:id="$+id:rl_main"
        ohos:height="match_parent"
        ohos:width="match_parent"
        ohos:layout_alignment="center"
        app:num="4"
        />
</DirectionalLayout>

代码设置

      coolMenuFrameLayout = (CoolMenuFrameLayout) findComponentById(ResourceTable.Id_rl_main);

        fractions.add(new Fraction1());
        fractions.add(new Fraction2());
        fractions.add(new Fraction3());
        fractions.add(new Fraction4());

        FractionListPageAdapter fractionList = new FractionListPageAdapter(
                ((MainAbility) getAbility()).getFractionManager(),
                ResourceTable.Id_rl_main) {
            @Override
            public int getCount() {
                return fractions.size();
            }

            @Override
            public Fraction getItem(int position) {
                return fractions.get(position);
            }
        };

        coolMenuFrameLayout.setAdapter(fractionList);
        String[] titles = {"CONTACT", "ABOUT", "TEAM", "PROJECTS"};
        titleList = Arrays.asList(titles);
        coolMenuFrameLayout.setTitles(titleList);

变动说明

新增 FactionListPageAdapter提供方便向控件提供Fraction信息。

License

coolMenu is available under the MIT license

1
https://gitee.com/archermind-ti/coolmenu.git
git@gitee.com:archermind-ti/coolmenu.git
archermind-ti
coolmenu
coolMenu
master

搜索帮助