PageAbility基本概念( 三 )

然后我们在layout布局下新建一个xml布局文件:my_layout.xml
<?xml version="1.0" encoding="utf-8"?><DirectionalLayoutxmlns:ohos="http://schemas.huawei.com/res/ohos"ohos:height="match_parent"ohos:width="match_parent"ohos:background_element="#33AA0000"ohos:orientation="vertical"><Textohos:height="match_parent"ohos:width="match_parent"ohos:text="新的入口"ohos:text_size="30fp"ohos:text_alignment="center"/></DirectionalLayout>这里我们复制到media里一个小图标t4.png:

PageAbility基本概念

文章插图
 
最后,我们要在config.json中设置:
{"app": {"bundleName": "com.example.hanrupageability","vendor": "example","version": {"code": 1000000,"name": "1.0.0"}},"deviceConfig": {},"module": {"package": "com.example.hanrupageability","name": ".MyApplication","mainAbility": "com.example.hanrupageability.MainAbility","deviceType": ["phone"],"distro": {"deliveryWithInstall": true,"moduleName": "entry","moduleType": "entry","installationFree": false},"abilities": [{"skills": [{"entities": ["entity.system.home"],"actions": ["action.system.home"]}],"orientation": "unspecified","name": "com.example.hanrupageability.MyAbility","icon": "$media:t4","label": "$string:entry_MainAbility","type": "page","launchType": "standard"},{"orientation": "unspecified","name": "com.example.hanrupageability.MainAbility","icon": "$media:icon","description": "$string:mainability_description","label": "$string:entry_MainAbility","type": "page","launchType": "standard"}]}}然后启动项目,这个APP部署:
PageAbility基本概念

文章插图
 
点进去,就有了新的入口:
PageAbility基本概念

文章插图
 
我们也可以通过DevEco-Studio直接新建Ability,这样随着Ability的创建,会自动创建该Ability对应的AbilitySlice以及该AbilitSlice要加载的xml布局文件:
PageAbility基本概念

文章插图
 
然后填入Ability的信息:
PageAbility基本概念

文章插图
 
还有还有,会自动的配置config.json文件,超爽的:
PageAbility基本概念

文章插图
 

【PageAbility基本概念】


推荐阅读


上一篇:typora+PicGo+github搭建程序员必备创作环境

下一篇:没有了