Denis Steinman
Denis Steinman

Reputation: 7809

Toolbar has too small height

Why Toolbar has so small height on start? But if user scrolls down then it looks like on second screenshot.
Screenshot on start Screenshot of expanded Toolbar
As you can see on screenshot it also has incorrect top padding. It's my layout xml of MainActivity:

<android.support.v4.widget.DrawerLayout
    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_height="match_parent"
    android:layout_width="match_parent"
    android:fitsSystemWindows="true" >

    <android.support.design.widget.CoordinatorLayout
        android:fitsSystemWindows="true"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <android.support.design.widget.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:fitsSystemWindows="true"
            android:theme="@style/Theme.Paper.AppBarOverlay">

            <android.support.v7.widget.Toolbar
                android:fitsSystemWindows="true"
                app:layout_scrollFlags="scroll|enterAlways"
                android:layout_height="?attr/actionBarSize"
                android:layout_width="match_parent"
                app:popupTheme="@style/Theme.Paper.PopupOverlay">

                <include
                    android:layout_width="match_parent"
                    android:layout_height="?attr/actionBarSize"
                    layout="@layout/toolbar_spinner" />

            </android.support.v7.widget.Toolbar>

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

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

        <android.support.design.widget.FloatingActionButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|end"
            style="@style/Theme.Paper.FloatingActionButton"/>

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

    <fragment
        class="com.test.modal.NavigatorFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        tools:layout="@layout/navigator"
        android:fitsSystemWindows="true"/>

</android.support.v4.widget.DrawerLayout>

Who knows that I doing wrong? In FrameLayout I inflate ViewPager if it has value.

Upvotes: 2

Views: 865

Answers (1)

Vuki Limani
Vuki Limani

Reputation: 100

so i think the problem is in android:layout_height="?attr/actionBarSize"

change it to android:layout_height="match_parent"

and than see what happend !

Upvotes: 4

Related Questions