Android日常(02) Must specify unique android:id, android:tag, or have a parent with an id for com.xxx.app.fragment
写在前面的话
使用fragent进行页面复用时遇到的问题
问题出现的场景
我写了一个fragment被其它页面复用
处理方式
用到的技术主要有:数据结构(栈)、activity生命周期(onCreate)、页面关闭方法(finish)
<fragment
android:id="@+id/vipFragment"
android:layout_width="match_parent"
android:name="com.aboutcg.app.fragment.VipFragment"
android:layout_height="match_parent" />
Must specify unique android:id, android:tag, or have a parent with an id for com.xxx.app.fragment
android:id="@+id/vipFragment"
结束语
喜欢加个关注支持一下后续会有更多更新内容
Android Fragment复用实践与问题解决
本文介绍了在Android开发中遇到的Fragment复用问题及其解决方案。在使用Fragment进行页面复用时,遇到了必须指定唯一android:id、android:tag或具有id父元素的错误。通过理解数据结构(栈)、Activity生命周期以及正确调用页面关闭方法(finish),成功解决了问题。
1317

被折叠的 条评论
为什么被折叠?



