I have an activity layout that includes my fragment container this way,
<include layout="@layout/content_main" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/background_container" /> and my fragment container is compose of linearlayout and a framelayout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/transparent" android:padding="10dp"> <FrameLayout android:id="@+id/fragment_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/transparent" /> </LinearLayout> The problem is that I have to add my scrollable fragment in this container but the scroll doesnt seem to work. My layout goes like this
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> ... ... </LinearLayout> </ScrollView> I have tried several answer like
- Using NestedScrollView
- Adding minimum height to framelayout
- Using fillViewport="true"
- etc.
But nothing seems to work. Any idea what I've been doing wrong? Any help would be appreciated. Thanks in advance! Cheers!
Edit:
My activity layout contains navigation drawer, i dont know if it matter. And i add the view using
ft.replace(R.id.fragment_container, myFragment).commit(); i also dont know if fragment replace messes with my view. Please help. Thanks