SlidingPaneLayout不覆盖左侧面板



如何理解它?为什么左侧面板没有隐藏?

我的xml文件:

<android.support.v4.widget.SlidingPaneLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment android:id="@+id/headlines"
          android:layout_height="match_parent"
          android:name="by.zubov.task.fragments.TitlesFragment"
          android:layout_width="380dp"
          />
<FrameLayout android:id="@+id/details" 
        android:layout_width="500dp"
        android:layout_weight="1"
        android:layout_height="match_parent" />

结果:图像结果

测试这是Htc One上的代码(显示540x960)。

您需要关闭SlidingPaneLayout,以便在XML 的末尾添加此行

</android.support.v4.widget.SlidingPaneLayout

同样(现在不应该是这种情况),但如果您在两个容器中都使用具有设定dp量的layout_with,那么在更大的屏幕上,两个布局可能会并排显示,这意味着您不能再滑动了。因此,我建议在至少1个容器(可能是详细信息窗格)上使用android:layout_width="match_parent"`,以防止这种情况在平板电脑上发生。

最新更新