Reputation: 11416
Any idea why the layout of a ccrosponding fragment
is not showing. The problem is that, i have two fragments
"sub" and "pub" and each of them has its own layout. First I designed the layout of the fragment
"sub" and in "sub"'s class that extends fragment
I inflated the view
f the "sub" activity thelayout of "sub". At run time, i find that the actionTab
"sub" has no view
and the view
i designed for it, is displayed on the fragment
"pub".
please le me know where that error comes from?
Update"Added Code:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.messagin_activity_layout);
mViewPager = (ViewPager) findViewById(R.id.pager);
mActionBar = getActionBar();
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
List<Fragment> mFragList = new ArrayList<Fragment>();
mFragList.add(new Pub_Frag());
mFragList.add(new Sub_Frag());
Code_"sub_Frag"
public class Sub_Frag extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
// TODO Auto-generated method stub
View v = inflater.inflate(R.layout.sub_frag_layout, container, false);
EditText et_topic = (EditText) v.findViewById(R.id.et_topic);
return v;
}
}
Upvotes: 0
Views: 41
Reputation: 11416
I think, the order in which you add your framents to the ArrayList
,"if you are using it", matters.
make sure that you add your fragments
t the arraylist
in the same order you assign hem to actiontab
Upvotes: 0