将NavigationDrawer置于SlidingUpPanel上方

时间:2018-08-24 03:57:00

标签: android navigation-drawer slidingpanelayout

enter image description here

我想在向上滑动面板上方制作导航抽屉。 我使用这个https://github.com/umano/AndroidSlidingUpPanel

 aws s3 presign s3://mybucket/some_folder/some_file

那是我的布局代码

所以我不明白生第二个孩子是什么意思 所以我不明白生第二个孩子是什么意思 所以我不明白生第二个孩子是什么意思 所以我不明白生第二个孩子是什么意思 所以我不明白生第二个孩子是什么意思

2 个答案:

答案 0 :(得分:0)

    <?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/drawer_layout"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:sothree="http://schemas.android.com/apk/res-auto">

    <com.sothree.slidinguppanel.SlidingUpPanelLayout
        android:id="@+id/suplSurveys"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="bottom"
        sothree:umanoScrollableView="@+id/vpPlace"
        sothree:umanoPanelHeight="68dp"
        sothree:umanoParallaxOffset="100dp"
        sothree:umanoDragView="@+id/dragView"
        sothree:umanoOverlay="true">

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

                <FrameLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <fragment
                        android:id="@+id/map"
                        android:name="com.google.android.gms.maps.SupportMapFragment"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent" />

                    <android.support.v7.widget.Toolbar
                        android:id="@+id/toolbar"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:background="#006df0"
                        app:titleTextColor="@color/colorBackGrey"
                        android:elevation="20dp"
                        app:layout_scrollFlags="scroll|enterAlways"
                        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_gravity="top|end"
                        android:layout_marginTop="65dp"
                        android:orientation="vertical">

                        <android.support.design.widget.FloatingActionButton
                            android:id="@+id/fab_my_location"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="top|end"
                            android:layout_marginTop="10dp"
                            android:layout_marginEnd="15dp"
                            app:backgroundTint="@color/jet"
                            app:fabSize="normal"
                            app:srcCompat="@drawable/ic_my_location" />

                    </LinearLayout>

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

                        <FrameLayout
                            android:layout_width="match_parent"
                            android:layout_height="60dp"
                            android:layout_marginBottom="65dp"
                            android:paddingLeft="80dp"
                            android:paddingRight="80dp"
                            android:layout_gravity="center">

                            <com.dd.morphingbutton.impl.IndeterminateProgressButton
                                android:id="@+id/add_new_location"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:gravity="center_horizontal"
                                android:fontFamily="@font/pt_mono"
                                android:layout_gravity="center_horizontal"
                                android:textSize="18sp"
                                android:textColor="@color/colorBackGrey"
                                android:text="ADD"/>

                        </FrameLayout>

                    </LinearLayout>

                </FrameLayout>

            <!--</android.support.v4.widget.DrawerLayout>-->
        </FrameLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="400dp"
            android:paddingRight="10dp"
            android:paddingLeft="10dp"
            android:background="@drawable/border"
            android:orientation="vertical"
            android:focusable="false"
            android:id="@+id/dragView">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="68dp"
                android:orientation="vertical">
                <TextView
                    android:layout_width="48dp"
                    android:layout_height="2dp"
                    android:layout_marginTop="5dp"
                    android:gravity="center"
                    android:layout_gravity="center"
                    android:background="#dddddd" />

                <TextView
                    android:layout_width="48dp"
                    android:layout_marginTop="5dp"
                    android:layout_height="2dp"
                    android:gravity="center"
                    android:layout_gravity="center"
                    android:background="#dddddd" />

                <TextView android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:textSize="14sp"
                    android:fontFamily="@font/pt_mono"
                    android:textStyle="bold"
                    android:text="DAFTAR LOKASI SURVEY"
                    android:textColor="@color/colorAccent"
                    android:gravity="center_vertical"
                    android:paddingLeft="10dp"/>

            </LinearLayout>

            <ProgressBar
                style="?android:attr/progressBarStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:id="@+id/pbLoad"
                android:gravity="center"
                android:layout_margin="15dp" />

            <android.support.v7.widget.RecyclerView
                android:id="@+id/vpPlace"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1" />

        </LinearLayout>

    </com.sothree.slidinguppanel.SlidingUpPanelLayout>

    <android.support.design.widget.NavigationView
        android:id="@+id/nvView"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:headerLayout="@layout/navdraw_header"
        app:menu="@menu/drawer_view" />


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

答案 1 :(得分:-1)

这应该是一个简单的修复程序,我看不到具有您的抽屉样式的布局xml(可以随意共享代码)。

使用标准导航视图作为示例,以提供与现在相同的布局:

<?xml version="1.0" encoding="utf-8"?>
<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:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:openDrawer="start">
    <android.support.design.widget.CoordinatorLayout
        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.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" />
        </android.support.design.widget.AppBarLayout>
        <LinearLayout
            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"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"
            tools:context=".MainActivity"
            tools:showIn="@layout/app_bar_main">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Hello World!"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintTop_toTopOf="parent" />
        </LinearLayout>
    </android.support.design.widget.CoordinatorLayout>
    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:menu="@menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>

显示类似(类似于您的内容)的

enter image description here

您需要将整个屏幕包裹在另一个布局中(可能是垂直的线性布局)。您将需要解压缩工具栏,并将其移到最外/顶部,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_height="match_parent"
    android:layout_width="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical">
    <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" />
    </android.support.design.widget.AppBarLayout>
    <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:id="@+id/drawer_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        tools:openDrawer="start">
        <android.support.design.widget.CoordinatorLayout
            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">
            <LinearLayout
                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"
                app:layout_behavior="@string/appbar_scrolling_view_behavior"
                tools:context=".MainActivity"
                tools:showIn="@layout/app_bar_main">
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello World!"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />
            </LinearLayout>
        </android.support.design.widget.CoordinatorLayout>
        <android.support.design.widget.NavigationView
            android:id="@+id/nav_view"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            android:fitsSystemWindows="true"
            app:menu="@menu/activity_main_drawer" />
    </android.support.v4.widget.DrawerLayout>
</LinearLayout>

这给您您想要的-工具栏现在将停留在顶部并显示为:

enter image description here

让我知道是否有帮助-请记住,由于我尚未看到任何代码,因此我做了一些假设。