Android ScrollView is not scrolling the content

时间:2016-02-12 22:11:28

标签: android android-layout

I have read dozens of similar posts here on StackExchange, however none of the suggestions have worked for me so far. This behavior is consistent in both the emulator and on my device (emulator is Nexus 5, device is Nexus 5X).

I've got several factors that could be contributing to the complexity. First, I am using fragments. Second, I am using a TableLayout inside the ScrollView. I am adding table rows programatically; each row contains two text views, thus creating two columns.

Here is my main activity layout XML (when loading the fragments, they are placed into fragment_container):

SELECT
    SUM(CASE WHEN datediff(day,_col1,_col2) = '0' THEN '1' ELSE '0' END) day0
    FROM dbo1
    WHERE  year(_col3) between year(getdate())-'1' and year(getdate()) 
    AND _col1 is not null
    AND _col2 is not null

Here is my fragment layout XML:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".activities.searches.saved.ViewSearchesActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/white"
            android:id="@+id/fragment_container">
        </FrameLayout>

    </android.support.design.widget.AppBarLayout>

</android.support.design.widget.CoordinatorLayout>

Here is the fragment code:

<FrameLayout 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"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    tools:context="com.jpvander.githubjobs.activities.searches.saved.ViewJobDetailsFragment">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fadeScrollbars="false"
        android:fillViewport="true"
        android:id="@+id/scrollView">

        <TableLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/table_layout"></TableLayout>
    </ScrollView>
</FrameLayout>

0 个答案:

没有答案