I used the following approach for ListFragment in LinearLayout:
class CustomListFragment extends ListFragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup v = (ViewGroup) super.onCreateView(inflater, container, savedInstanceState); v.setLayoutParams(new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1)); return v; } }
Now that I have read your comments on another answer, I see that it looks like what you thought.
But note: a structure can instantiate your fragments. Therefore, the class must be publicly available and must have a constructor without any additional arguments.
Any tuning methods for setting up your fragments will not work therefore, since they will not be called for any instances created by the frame.
source share