0

当 SlidePaneLayout 关闭时,它会覆盖整个窗口,当 slidePaneLayout 处于关闭状态时,我需要查看背景。

即,覆盖布局应覆盖 80%,而其余 20% 的背景应可见。

就像您在导航抽屉中看到的那样,

我已经尝试了所有的教程和库,是否有任何简单的解决方案,例如设置 layout_weight 或 layout_width?

我试过了,但没有用。

有人可以帮忙吗。

<android.support.v4.widget.SlidingPaneLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"
    android:background="@android:color/transparent"
    android:windowBackground="@android:color/black"
     android:id="@+id/sp" > 

     <!-- Left side pane. (Master) --> 
     <LinearLayout android:id="@+id/leftpane" 
         android:layout_width="250dp" 
         android:layout_height="match_parent" 
         android:background="#DFDEFF"
         android:orientation="horizontal" >
         </LinearLayout> 

         <!-- Right side page. (Slave) --> 
         <LinearLayout android:id="@+id/rightpane" 
             android:layout_width="0px" 
             android:layout_height="match_parent"
             android:layout_weight="1"          
             android:background="#FFFFFF"
             android:orientation="horizontal">
         </LinearLayout> 

</android.support.v4.widget.SlidingPaneLayout> 
4

1 回答 1

0

您应该将背景设置layout_width为合适的数字。覆盖的layout_width 不应该是'0dp'!可以是任意数字,例如“match_parent”。

无论您设置什么,内容面板始终设置为“match_parent”。

左面板和右面板(内容面板)不在同一平面上。

于 2014-05-24T05:37:27.897 回答