Why Is My Included Layout's Tag Returning Null?
Using the below layouts, getView(R.id.included).getView(R.id.text_view) evaluates to null. If I surround the TextView in a LinearLayout the problem disappears. What's going on he
Solution 1:
<include>
isn't exactly well documented.
Tor Norbye wrote:
The <include>
tag is not a real view, so findByView
will not find it. The @id
attribute (and any other attributes you've set on the include tag) gets applied on the root tag of the included layout instead. So your activity.getView(R.id.included1)
should in fact be the <TextView>
itself.
Post a Comment for "Why Is My Included Layout's Tag Returning Null?"