Q:

AndroidPlot XYPlot and a Table in ScrollView does not show scroll to see the complete table

Screenshot of what I am trying to achieve. I have XYPlot and a Table in vertical orientation. As you can see , there is no vertical scrolling to see the rest of the table data. I have tried setting different attributes like android:fillViewport="true"  and layout_weight etc. But none seems to work. Any pointer would be helpful.

Here are my layout files - 

activity_stock_forecast.xml

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true"
    android:layout_weight="1"
    android:orientation="vertical"
    android:background="@color/grey"
    >

    <LinearLayout
        android:id="@+id/container"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        >

        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginBottom="20dp"
            android:id="@+id/linearLayout1">
            <TextView
                android:id="@+id/stock_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="20dp"
                android:layout_marginLeft="20dp"
                android:layout_marginTop="20dp"
                android:gravity="center_horizontal"
                android:textColor="@color/lightBrown"
                android:text="Stock Name"
                android:textSize="17dip"
                android:textStyle="italic"
                android:typeface="sans"
                android:editable="false" />
            <TextView
                android:id="@+id/viewUnderLine1"
                android:layout_width="fill_parent"
                android:layout_height="0dp"
                android:layout_marginRight="20dp"
                android:layout_marginLeft="20dp"
                android:layout_marginTop="-5dp"
                android:background="@drawable/underline" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_below="@+id/linearLayout1"

            android:id="@+id/linearLayout2">
            <include layout="@layout/simple_xy_plot_example" />
        </LinearLayout>
</RelativeLayout>

        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginTop="20dp"
            android:id="@+id/linearLayout3"

            >
            <TextView
                android:id="@+id/asklabe2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="20dp"
                android:layout_marginLeft="20dp"
                android:layout_marginTop="20dp"
                android:gravity="center"
                android:textColor="@color/lightBrown"
                android:text="Projection for Next Few Quarters"
                android:textSize="17dip"
                android:textStyle="italic"
                android:typeface="sans"
                android:editable="false" />
            <HorizontalScrollView
                android:id="@+id/horizontalScrollView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:scrollbarFadeDuration="0"
                android:layout_margin="10dp"
                android:paddingLeft="5dp"
                android:paddingRight="5dp">
                <TableLayout
                    android:id="@+id/forcastTable"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:layout_margin="20dp"
                    android:background="@drawable/table_row_style"
                    android:stretchColumns="*"
                    >
                    <include layout="@layout/stock_forecast_table_row" />
                </TableLayout>
            </HorizontalScrollView>
        </LinearLayout>
        </RelativeLayout>
    </LinearLayout>
</ScrollView>

simple_xy_plot_example

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ap="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent">

<com.androidplot.xy.XYPlot
    style="@style/APDefacto.Dark"
    android:id="@+id/plot"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    layout_height="700px"
    ap:title=""
    ap:lineLabelInsetLeft="10dp"
    ap:rangeTitle="Price"
    ap:domainTitle="Months"
     />

stock_forecast_table_row

<TableRow android:id="@+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/table_row_style"
xmlns:android="http://schemas.android.com/apk/res/android">

    <TextView
        android:id="@+id/row_title"
        android:paddingBottom="10dp"
        android:paddingLeft="10dp"
        android:paddingTop="10dp"
        android:text="Revenue %"
        android:gravity="center"
        android:textAlignment="center"
        android:textColor="@color/grey"
        android:textSize="16sp" />

    <LinearLayout
        android:layout_width="1dp"
        android:layout_height="match_parent" >

        <View style="@style/Divider" />
    </LinearLayout>

    <TextView
        android:id="@+id/col_q4"
        android:paddingBottom="10dp"
        android:paddingLeft="5dp"
        android:paddingRight="5dp"
        android:paddingTop="10dp"
        android:text="1234567890"
        android:textColor="@color/grey"
        android:textSize="16sp"
        android:gravity="center"
        />

<LinearLayout
    android:layout_width="1dp"
    android:layout_height="match_parent" >

    <View style="@style/Divider" />
</LinearLayout>

<TextView
    android:id="@+id/col_q3"
    android:paddingBottom="10dp"
    android:paddingLeft="5dp"
    android:paddingRight="5dp"
    android:paddingTop="10dp"
    android:text="1234567890"
    android:textColor="@color/grey"
    android:textSize="16sp"
    android:gravity="center"
    />
<LinearLayout
    android:layout_width="1dp"
    android:layout_height="match_parent" >

    <View style="@style/Divider" />
</LinearLayout>

<TextView
    android:id="@+id/col_q2"
    android:paddingBottom="10dp"
    android:paddingLeft="5dp"
    android:paddingRight="5dp"
    android:paddingTop="10dp"
    android:text="1234567890"
    android:textColor="@color/grey"
    android:textSize="16sp"
    android:gravity="center"
    />

<LinearLayout
    android:layout_width="1dp"
    android:layout_height="match_parent" >

    <View style="@style/Divider" />
</LinearLayout>

<TextView
    android:id="@+id/col_q1"
    android:paddingBottom="10dp"
    android:paddingLeft="5dp"
    android:paddingRight="5dp"
    android:paddingTop="10dp"
    android:text="1234567890"
    android:textColor="@color/grey"
    android:textSize="16sp"
    android:gravity="center"
    />
<LinearLayout
    android:layout_width="1dp"
    android:layout_height="match_parent" >

    <View style="@style/Divider" />
</LinearLayout>

<TextView
    android:id="@+id/last_one"
    android:paddingBottom="10dp"
    android:paddingLeft="5dp"
    android:paddingRight="5dp"
    android:paddingTop="10dp"
    android:text=""
    android:textColor="@color/grey"
    android:textSize="16sp"
    android:gravity="center"
    />

A:

After lot of trial & error with setting attributes, found that you need to set android:layout_height to fixed height. The wrap_content/match_parent wont work.
So I made change to simple_xy_plot_example.xml as follows and it worked.
android:layout_height="350dp"

