How to use View Stub in android
Like the documentation says, ViewStub is a View that is inflated lazily. You can declare a ViewStub in an XML file like this: <ViewStub android:id=”@+id/stub” android:inflatedId=”@+id/subTree” android:layout=”@layout/mySubTree” android:layout_width=”120dip” android:layout_height=”40dip” /> The android:layout attribute is a reference to the View that will be inflated next to a call of inflate(). So ViewStub stub = (ViewStub) findViewById(R.id.stub); … Read more