SlidingPaneLayout Example

In this tutorial, I will explain how to use SlidingPaneLayout. It’s an interesting component which can be used whenever we want a multi-pane horizontal layout in our app. It is divided in two different parts:

left side: The master pane which usually contains a list of values.

right side: The detail pane which usaully contains the details of the values in the left side.

In short you can say that left pane is treated as a content list or browser or as a subordinate to a primary detail view for displaying content. SlidingPaneLayout can be used to fragment or other components, we just need to make sure that in our main layout it has to be the root.

Let’s have a look on how to write code for all which we have discussed above. Please follow the steps below:

Step1: Create a new android project in your android IDE.

Step2:Write following into you layout file:


Step3: Your java file should be like below:



Step4: Run for the output shown below:




Check my previous on Customized Toast Messages.

Leave a Comment: