中国优质的IT技术网站
专业IT技术创作平台
IT职业在线教育平台
安卓闪屏页的实现可以通过开辟一个新的线程去实现? 鸿蒙开发是怎么实现的? 有具体代码参考吗??本人新人小白一枚,今天刚入住harmonyOS
微信扫码分享
/** * 启动页 */ public class LauncherAbility extends Ability { Timer timer; @Override public void onStart(Intent intent) { getWindow().addFlags(WindowManager.LayoutConfig.MARK_TRANSLUCENT_NAVIGATION); super.onStart(intent); super.setUIContent(ResourceTable.Layout_ability_launcher); timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { // 跳转主页 goToMain(); } }, 2000); } @Override protected void onStop() { super.onStop(); timer.cancel(); } /** * 跳转主页 */ private void goToMain() { Intent mIntent = new Intent(); Operation operation = new Intent.OperationBuilder() .withBundleName(getBundleName()) .withAbilityName(MainAbility.class) .build(); mIntent.setOperation(operation); startAbility(mIntent); terminateAbility(); } }