I have a design like this : XMLFile1.xml
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/option_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ScrollView
android:name="question_paper_scrollView"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
<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"/>
</ScrollView>
</RelativeLayout>
XMLFile2.xml
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="match_parent">
<include layout=XMLFile1.xml>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:gravity="center|bottom"
android:weightSum="4"/>
</RelativeLayout>
I have set the android:fillViewport="true" in ScrollView according to this and also set the minimumHeight() of the FrameLayout as per this. FrameLayout holds the quiz questions and they need to be scrollable and the LinearLayout consists of set of buttons like next, previous and clear. I learnt from this LinearLayout can hide the ScrollView but I can see the ScrollBar. What is the correct way to achieve : Scrollable questions with given design?
PS: I am constrained to use LinearLayout because I want set of buttons at the bottom of the screen and to use FrameLayout because I am loading the quiz questions dynamically from the database.
SOLUTION: COMBINATION OF BOTH THE ANSWERS. USE wrap_content in all the layouts and user layout_below attribute in linear layout