Vote count:
0
I have a tabbed Android Application that uses Fragments on each page of the tab. I have a button inside of a fragment, and I use that button to bring another fragment on to the screen. The button works as you can see the second Fragment when it is pressed, the only problem is that the second Fragment appears over the first fragment, making the text in the second Fragment unreadable as the text from the first fragment is behind it. How do I get the first Fragment to go away when the second Fragment appears.
Here is the code for the button listener.
@Override
public void onClick(View v) {
Fragment frag = new ContactsFragment();
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.fragment_container, frag);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
ft.addToBackStack(null);
ft.commit();
}
asked 1 min ago
Fragment appearing on top of another Fragment
Aucun commentaire:
Enregistrer un commentaire