I have strange issue while adding/replacing new fragment. My new fragment is outside the screen.
bootom is outside of the display area
This is my fragment container (activity_main.xml)
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/activity_main_fl_full_screen_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
</RelativeLayout>
While I`m adding new fragments from activity level, everything is fine. This issue happens only, when I use callback from fragment A/B/C/D... etc. to MainActivity - to add/replace fragment in activity method (method from callback interface).
I noticed, that the problem is gone when I call add/replace method twice, then the first added fragment is outside the screen, but the second one is correct. Second important thing - there is no problem on devices without this android bar at bottom of display area (like Samsung XCover).
Method for adding fragments:
public static void addToBackStack(FragmentManager fm,
Fragment fInstance,
String fragmentTag,
int frameLayoutId) {
Log.d(TAG, " addToBackStack --> " + fragmentTag);
FragmentTransaction ft = fm.beginTransaction();
//ft.replace(frameLayoutId, fInstance, fragmentTag);
ft.add(frameLayoutId, fInstance, fragmentTag);
ft.addToBackStack(fragmentTag);
ft.commit();
}