1

このタイプの問題は、ここで何度も議論されていることを知っています。しかし、私の場合、それらのどれも私のために働いていません。プロジェクトでナビゲーション ドロワーを使用してAndroidSlidingUpPanelを使用しています。問題は、スライド パネル レイアウトが常にナビゲーション ドロワーの上に表示されることですが、私が望むのは逆です。現在の状態はこちら

ここに画像の説明を入力

ご覧のとおり、ナビゲーション ドロワーの項目が表示されません。パネル レイアウトをスライドさせると、ナビゲーション ドロワーが非表示になります。

これが私のコードです

<?xml version="1.0" encoding="utf-8"?>

<com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/sliding_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="bottom"
    sothree:umanoDragView="@+id/dragView"
    sothree:umanoOverlay="false"
    sothree:umanoPanelHeight="68dp"
    sothree:umanoParalaxOffset="100dp"
    sothree:umanoShadowHeight="4dp">


    <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/drawerMainActivity"
        android:layout_width="match_parent"
        android:layout_alignParentBottom="true"
        android:layout_height="match_parent">



        <FrameLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/containerView">

            <android.support.v7.widget.Toolbar
                xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:minHeight="?android:attr/actionBarSize"
                android:background="?attr/colorPrimary"
                android:id="@+id/toolBar"
                android:fitsSystemWindows="true"
                android:theme="@style/ThemeOverlay.AppCompat.Dark"
                />

        </FrameLayout>


        <android.support.v7.widget.RecyclerView
            android:layout_width="240dp"
            android:layout_height="match_parent"
            android:id="@+id/recyclerView"
            android:scrollbars="vertical"
            android:background="#FFFFFF"
            android:layout_gravity="left"
            />

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


    <!-- SLIDING LAYOUT -->
    <LinearLayout
        android:id="@+id/dragView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#ffffff"
        android:clickable="true"
        android:focusable="false"

        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <TextView
                android:id="@+id/name"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:textColor="@android:color/holo_green_dark"
                android:gravity="center_vertical"
                android:paddingLeft="10dp"
                android:text="@string/slide"
                android:textSize="14sp" />

            <Button
                android:id="@+id/btn_hide"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:gravity="center_vertical|right"
                android:paddingLeft="10dp"
                android:paddingRight="10dp"
                android:text="@string/hide"
                android:textSize="14sp" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#FFCCCC">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="10dp"
                android:layout_weight="1"
                android:scaleType="centerCrop"
                android:src="@drawable/image" />
        </LinearLayout>
    </LinearLayout>


</com.sothree.slidinguppanel.SlidingUpPanelLayout>

この問題を解決するにはどうすればよいですか? そのため、ナビゲーション ドロワーは常にスライド パネル レイアウトの上に表示されます。

4

2 に答える 2

1

Z 軸を設定するには、ツリーを注文する必要があります。ドキュメントから

View.html#描画

ツリーは大部分が記録され、順序どおりに描画されます。親は子の前 (つまり、後ろ) に描画され、兄弟はツリーに表示される順序で描画されます。ビューにバックグラウンド ドローアブルを設定すると、ビューはその onDraw() メソッドをコールバックする前にそれを描画します。子の描画順序は、ViewGroup 内のカスタムの子の描画順序、およびビューに設定された setZ(float) custom Z values} でオーバーライドできます。

したがって、基本的に Drawerlayout を最後に設定します。

于 2016-02-17T09:22:08.173 に答える