How to set parameters like height, width ,margins for fragments programatically. I am adding fragments like
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
MyListFragment myListFragment = new MyListFragment();
fragmentTransaction.add(1, myListFragment);
DetailFragment detailFragment = new DetailFragment();
fragmentTransaction.add(1, detailFragment);
fragmentTransaction.commit();
Also I am using compatabilty jar like android-support-v4.jar.
Thanks.
Fragments do not have “parameters like height, width ,margins”.
ViewandViewGrouphave “parameters like height, width ,margins”. So, you either adjust the container into which you are placing the fragment (which, for some strange reason, you have declared as1in your examples above), or you adjust theViewthat yourFragmentreturns fromonCreateView().