Search code examples
javaandroidslidingpanelayout

SlidingPaneLayout programmatically change the width of the left panel


What I want is that the 1st time that the user open my app the left panel can use the full screen! then I need to resize it.


Solution

  • After reading the SlidingPaneLayout source :SlidingPaneLayout.java, you will find DEFAULT_OVERHANG_SIZE = 32 in this class as the default size of the overhang for a pane in the open state.

    Since this is a private static constant,you need to change it into a variable and create its set method.

    Take care of onMeasure() method and good luck.