3

I have made a base-activity with a toolbar and add my layouts to this. But when I add a scrollview in the main content it doesn't show the bottom part when scrolling down. The missing part seems to be the same height as the toolbar.

My activitybase.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical">
    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        style="@style/ToolBarStyle"
        android:background="?attr/colorPrimary" />
    <FrameLayout
        android:id="@+id/root_container"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" />
</LinearLayout>

My fragmentinfo.xml:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fillViewport="true">
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/default_margin">
        <TextView
            android:id="@+id/info_header"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/default_margin"
            android:text="hei"
            style="@style/TextLarge" />
        <TextView
            android:id="@+id/info_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/small_margin"
            android:text="-SOME LONG TEXT-"
            style="@style/TextNormal" />

      <TextView
            android:id="@+id/info_header2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/default_margin"
            android:text="Test"
            style="@style/TextLarge" />
    </LinearLayout>
</ScrollView>

Screenshot below. This is scrolled all the way down. "Test" should be showing with 16 dp margin below it...

enter image description here

Gober
  • 3,632
  • 3
  • 26
  • 33

2 Answers2

1

In FrameLayout

<FrameLayout
  ...
  android:layout_marginBottom="56dp"
  ...
/>

Here 56dp is the Action Bar size.

arpit
  • 1,462
  • 1
  • 12
  • 12
  • Thank you for the answer. But this will give me a bottom margin on all my pages. The issue is only in one scrollview when scrolling down. – Gober May 22 '15 at 06:12
0

Add android:layout_marginBottom to the ScrollView, using the action bar height dimen.

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="@dimen/abc_action_bar_default_height_material"
    android:fillViewport="true">
Veener
  • 4,771
  • 2
  • 29
  • 37