Skip to content
Menu
(◍ ´꒳` ◍)

  • Blog
  • Front Page
(◍ ´꒳` ◍)

鸿蒙32AbilitySlice 路由配置

By admin on 2021年9月29日

AbilitySlice 路由配置
虽然一个 Page 可以包含多个 AbilitySlice,但是 Page 进入前台时界面默认只展示一个
AbilitySlice。默认展示的 AbilitySlice 是通过 setMainRoute()方法来指定的。如果需要更改默
认展示的 AbilitySlice,可以通过 addActionRoute()方法为此 AbilitySlice 配置一条路由规则。
setMainRoute()方法与 addActionRoute()方法的使用示例如下:

public class MyAbility extends 延伸Ability {
@Override
public void onStart(Intent意图 intent) {
super.onStart(intent);
// set the main route路线
setMainRoute(MainSlice.class.getName());

// set the action route addActionRoute(“action.pay”, PaySlice切片.class.getName()); addActionRoute(“action.scan”, ScanSlice.class.getName()); } } addActionRoute()方法中使用的动作命名,需要在应用配置文件(config.json)中注册: { “module”: { “abilities”: [ { “skills”:[ { “actions”:[ “action.pay”, “action.scan” ] } ] … } ] … }

Category: 鸿蒙

文章导航

鸿蒙31Page Ability
鸿蒙33Page Ability 生命周期

Related Posts

承认平庸-iptables高级-limit模块-17

3月 2, 2023
Read More

鸿蒙37实现 IAbilityContinuation 接口

10月 3, 2021
Read More

鸿蒙26数据收集及使用最小化

9月 16, 2021
Read More

发表回复 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注

近期文章

  • 实施002
  • 实施SQL001
  • 泛微oa001-字段
  • 硬件前端-海康威视摄像头
  • 使用Docker搭建Weblogic服务001

近期评论

    归档

    • 2023年10月
    • 2023年9月
    • 2023年8月
    • 2023年5月
    • 2023年4月
    • 2023年3月
    • 2021年11月
    • 2021年10月
    • 2021年9月
    • 2021年8月
    • 2021年5月

    分类

    • C
    • docker
    • iptable
    • ISIS
    • java
    • k8s
    • liunx
    • OpenCV py
    • ospf
    • solr
    • zabbix
    • 劳动法
    • 周杰伦
    • 格林法则
    • 等保
    • 鸿蒙

    其他操作

    • 登录
    • 条目feed
    • 评论feed
    • WordPress.org
    ©2025 (◍ ´꒳` ◍) | WordPress Theme by Superb WordPress Themes