I'm using Tabs with the FragmentStatePagedAdapter. THe code below is from the onOptionsItemSelected(MenuItem item)
method:
case R.id.menu_help:
System.out.println("Pressin' da help button!");
FragmentManager mananger = getSupportFragmentManager();
android.support.v4.app.FragmentTransaction trans = mananger.beginTransaction();
trans.replace(android.R.id.content, new HelpFragment());
trans.addToBackStack(null);
trans.commit();
break;
android.R.id.content
will however only replace the view below the actionbar (and overlay it over the tab-fragments).
Is there a simple way how to replace the entire screen with a fragment (shouldn't there be some other system resource for that?) without having to create a new activity for that? Or would a new activity actually be better?
Thanks in advance for the help
Container Layout (started at launch from MainActivity):
<android.support.v4.view.ViewPager
android:id="@+id/masterViewPager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
And I guess this is the class of the HelpFragment:
public class HelpFragment extends Fragment {
private View view;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle states) {
view = inflater.inflate(R.layout.layout_help_screen, container, false);
return view;
}
}
And the Fragment XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/nothing" />
</LinearLayout>