HarmonyOS 鸿蒙Next findComponentById转换错误:不兼容的类型 Component无法转换为RadioContainer
HarmonyOS 鸿蒙Next findComponentById转换错误:不兼容的类型 Component无法转换为RadioContainer 问题发生代码:radioContainer = findComponentById(ResourceTable.Id_radio_container_1); //初始化单选框
报错内容如标题,类型不兼容
但是不知道怎么改,help!
代码内容如下:
更多关于HarmonyOS 鸿蒙Next findComponentById转换错误:不兼容的类型 Component无法转换为RadioContainer的实战教程也可以访问 https://www.itying.com/category-93-b0.html
4 回复
加个强制转换
更多关于HarmonyOS 鸿蒙Next findComponentById转换错误:不兼容的类型 Component无法转换为RadioContainer的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
ok了,感谢大佬,
除了楼上的方法,还有就是把build.gradle里面的compileSdkVersion改成7版本,以前我的是6版本,改成7版本的就不报错了。
姓名:张三 性别:男 年龄:28 职业:软件工程师 技能:Python, Java, C++