SlidingPaneLayout does not cover the left side panel

368 views Asked by At

how to understand it? why the left panel is not hidden?

My xml file:

<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" />

result: Image result

testing this is code on Htc One (display 540x960).

1

There are 1 answers

0
Spirit009 On

you need to close your SlidingPaneLayout so you should add this line at the end of your XML

</android.support.v4.widget.SlidingPaneLayout

also (this shouldn't be the case right now) but if you use layout_with with a set amount of dp in both containers, it is possible that on a bigger screen both layouts are shown next to each other which means you can't swipe/slide anymore. So i'd recommend using android:layout_width="match_parent"` on at least 1 of your containers (probably the details pane) to prevent that from happening on a tablet for example.