0

The SlidingMenu demo app from the PlayStore works without any problem on my N7. But when I compile it from my computer, I have the following problem in ResposiveUI Activity : when I open the SlidingMenu on Portrait and change the orientation to Lanscape Mode... half screen is blank !

ResposiveUI in Portrait Mode ResponsiveUi in Landscape Mode

I didn't change anything in code except extending SherlockFragmentActivity as adviced here by the author.

2t0m
  • 165
  • 1
  • 13
  • This doesn't answer your question, but I'd advise against using anything but the official implementation. It's also significantly better for performance. – Michell Bak Jul 19 '13 at 17:47
  • It could be a good idea but I guess Navigation Drawer can't stay open without hiding content on big screens. SlidingMenu does. – 2t0m Jul 20 '13 at 06:08
  • Yep, that's right. Didn't know that though :) – Michell Bak Jul 20 '13 at 09:25

2 Answers2

0

the half blank screen is cased by SlidingMenu demo source code 70 line.

https://github.com/jfeinstein10/SlidingMenu/blob/master/example/src/com/jeremyfeinstein/slidingmenu/example/fragments/ResponsiveUIActivity.java

You can modify it to

        if (findViewById(R.id.menu_frame) == null) {
            sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
        else
            sm.setBehindOffset(getScreenWidth());

getScreenWidth()

  public int getScreenWidth() {
            Display display = getWindowManager().getDefaultDisplay();
            DisplayMetrics metrics = new DisplayMetrics();
            display.getMetrics(metrics);
            return metrics.widthPixels;
    }
Jiang Qi
  • 4,450
  • 3
  • 19
  • 19
0

The problem is that SlidingMenu is still open when screen is rotating. Closing it before Saving Instant State solves the problem.

    @Override
    public void onSaveInstanceState(Bundle outState) {
        showContent();
        super.onSaveInstanceState(outState);
        getSupportFragmentManager().putFragment(outState, "mContent", mContent);
    }
2t0m
  • 165
  • 1
  • 13