Question

Hey so I'm trying to figure out how the Sliding Pane layout works. I set up a fairly simple example based on the following post: Exploring Sliding Panel Layout .

The example compiles and runs but I don't quite understand how the sliding is supposed to work. All I get is 2 static panels on my screen that do not move. What am I missing here? Thanks

activity_slide_panel.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" >

    <TextView android:layout_width="250dp"
        android:layout_height="match_parent"
        android:background="#CC00FF00"
        android:text="Pane 1" />

    <TextView android:layout_width="400dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="#CC0000FF"
        android:text="Pane 2" />
</android.support.v4.widget.SlidingPaneLayout>

SlidePanel.java

public class SlidePanel extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_slide_panel);
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.slide_panel, menu);
        return true;
    }
}

**

Was it helpful?

Solution

Sorry I didn't provide enough information, nor did I understand what I was doing. I am using a tablet horizontally. As soon as I used a phone with a smaller screen, it began working.

OTHER TIPS

Problem is in the second pane width. Set second pane width to match-parent.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top