【发布时间】:2021-06-01 14:09:27
【问题描述】:
我有一个带有ConstraintLayout 和片段的活动:
<androidx.constraintlayout.widget.ConstraintLayout
...attributes....
>
<fragment
android:id="@+id/containerView"
app:navGraph="@navigation/some_navigation"
...other attributes...
/>
...other views...
我在活动代码中使用视图绑定:
binding = ActivityMainBinding.inflate(layoutInflater)
这里的问题是我无法访问binding.containerView。
如果是fragment 我应该使用findViewById 吗?
【问题讨论】:
标签: android android-fragments android-viewbinding