标签中的android:id属性定义的是Fragment的id,而不是View的id。因此,无法使用ViewBinding查询到该id。如果想要在代码中访问该Fragment,可以使用FragmentManager的findFragmentById()方法来获取该Fragment实例。

为什么fragment androidid=+idnewsContentFrag androidname=comexamplefragmentbestpracticeNewsContentFragment androidlayout_width=match_parent androidlayout_height=match_parent

原文地址: http://www.cveoy.top/t/topic/imsN 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录