konmik/StackLayout

Dialog boxes cannot dim ActionBar/Toolbar

scriptacus opened this issue · 4 comments

The dialog functionality provided by StackLayout does not dim the ActionBar or Toolbar when using the StackLayout view as a "container" style view.

It should not dim ActionBar.

If you're going plain-old-views path, you don't need that buggy and useless stuff ;)

However, it should dim Toolbar, even if I don't like it. :D What is your xml?

        <android.support.v4.widget.DrawerLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/drawer"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <include
                android:id="@+id/toolbar_actionbar"
                layout="@layout/toolbar_default"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>

            <stacklayout.view.StackLayout
                android:id="@+id/container"
                android:layout_width="match_parent"
                android:layout_height="match_parent">
            </stacklayout.view.StackLayout>

        </LinearLayout>
        <fragment
            android:id="@+id/fragment_drawer"
            android:layout_marginTop="@dimen/abc_action_bar_default_height_material"
            android:name="prototypebydesign.lifts.NavigationDrawerFragment"
            android:layout_width="@dimen/navigation_drawer_width"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            app:layout="@layout/fragment_navigation_drawer"/>
    </android.support.v4.widget.DrawerLayout>

Instead of LinearLayout use FrameLayout.

Set padding_top on StackLayout equal to toolbar's height.

Set clipToPadding=false on StackLayout.

Done! :)

(You don't have to use fragment in drawer if you don't like to.

That worked beautifully. Thanks.