更多内容请访问:与华为官方共建的鸿蒙技术社区https://harmonyos.51cto.com众所周知,安卓应用经过这么多年的发展,发展相对成熟稳定。鸿蒙OS作为后来者,兼容成熟的开发体系,将节省大量的推广和开发成本。但是在实际开发中,在代码层面还是存在很多细节上的差异,这会给初次开发者带来困扰。本手册旨在总结实际开发中接入第三方软件时的代码差异,以帮助开发者更好的开发运营。由于目前接触的开发类型有限,总结的内容会有所疏漏。我们将进一步发展完善和完善。欢迎关注我们和我们的专栏,以便您及时获取相关内容的更新。Message&Multithreading1.设置线程级别Android:android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_XXXXX);鸿蒙:ProcessManager.setThreadPriority(Thread.xxx);2、判断是否是主线程Android:Looper。getMainLooper().getThread()==Thread.currentThread()鸿蒙:EventRunner.getMainEventRunner().isCurrentRunnerThread();3、取消任务操作Android:task.cancel(true);鸿蒙:task.revoke();Layout&Component1.显示一段时间的提示信息。安卓:ToastmakeText(Contextcontext,Stringmsg,intduration).show();鸿蒙:newToastDialog(Contextcontext).setText(Stringmsg).show();2、为右上图的Android控件设置它的左侧:1、代码中:DrawabledwLeft=getResources().getDrawable(R.mipmap.ic_launcher);dwLeft.setBounds(0,0,dwLeft.getMinimumWidth(),dwLeft.getMinimumHeight());View.setCompoundDrawables(dwLeft,null,null,null);2.布局中:android:drawableLeft="@mipmap/ic_launcher"android:drawableTop="@mipmap/ic_launcher"android:drawableRight="@mipmap/ic_launcher"android:drawableBottom="@mipmap/ic_launcher"鸿蒙:1.在代码:Resourceresource=context.getResourceManager().getResource(ResourceTable.Media_select);PixelMapElementelement=newPixelMapElement(resource);companent.setAroundElements(element,null,null,null);2。在布局中:ohos:element_left="media:icon"ohos:element_right="media:icon"ohos:elementright="media:icon"ohos:element_top="media:icon"ohos:element_bottom="media:icon"ohos:elementbottom="media:icon"3.设置控件的多态Android:1。在布局中设置控件:android:background="@drawable/bt_login"2.在xml中实现bt_login
