Reputation: 407
Can i access the Child's of included layout that included the main activity layout, directly by findViewById()
method in main activity?
Upvotes: 3
Views: 2344
Reputation: 357
You can totally access child by findViewById. When you include one layout in other layout, it's same when you code inside.
Upvotes: 0
Reputation: 640
Yeah this way.
//in XML
<include layout="@layout/extLayout"
android:id="@+id/myLayout" />
//in Activity
View view= findViewById(R.id.myLayout);
Button button= (TextView) view.findViewById(R.id.button);
Upvotes: 4
Reputation: 6622
yes you can access that included layout in activity layout using findValueById()
Upvotes: 0