Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ScrollView below Toolbar fails to show all content

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

like image 231
Gober Avatar asked Nov 19 '25 13:11

Gober


1 Answers

In FrameLayout

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

Here 56dp is the Action Bar size.

like image 153
arpit Avatar answered Nov 21 '25 02:11

arpit



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!