I have the following layout.
It's an old question, but I've got a useful addition
1) Yes, like others have posted - use same id
and inflatedId
:
2) When you need to inflate view or refresh its content it's convenient to act like this:
View v = parentView.findViewById(R.id.view_stub_id);
if (v instanceof ViewStub)
v = ((ViewStub) v).inflate();
// here v is always the inflated view
// ...