在我的
Android项目中,我有两个布局:num_info和num_info_pack.两者都有id“circle”的视图.所以我认为通过layout_name.circle引用这些视图可以解决问题:
val inetView = activity.layoutInflater.inflate(R.layout.num_info_pack,parent,false) inetView.circle.setBackgroundResource(background)
但圆圈用红色加下划线,它说:
Overload resolution ambiguity. All these functions match.
public val View.circle: View! defined in
kotlinx.android.synthetic.main.num_info_pack.viewpublic val View.circle: RelativeLayout! defined in
kotlinx.android.synthetic.main.num_info_inet_plus_pack.view
如果我特意说inetView.circle,为什么我在谈论哪个圈子?