I have a ListFragment
displaying a list of items that created by the user. I have a ListView
with it\'s id set to \"@android:id/list\" and a
Another solution is use LinearLayout Instead of fragment
<Fragment
android:name="path/to.package.MyClass"
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="100dp"
/>
USE it like this
<LinearLayout
android:name="path/to.package.MyClass"
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="100dp"
/>
An other problem that solved the issue in my case were diffentent API imports.
Make sure, that you use "support.v4" or the "original" implementations from API 11 and do not mix them. (this can happen, in my case: TransactionManager was v4 and the Activity an older version, or the other way around)
I had a similar problem.
According to this when you need to add Fragments
programmatically, you should add them to an existing ViewGroup
.
So I removed the Fragment
from the xml and used FrameLayout
component in the replace()
method.
You can also have a look here.
Hope this helps.
Give a background color to the main layout of the childFragment.
Like android:background="#FFFFFF"
This worked for me!!!!
I solved changing the RelativeLayout for a LinearLayout... Hope it helps!
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/windowBackground">
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>