DrawerLayout and SurfaceView match side slide display is not complete

I’ve been very busy lately. I wanted to have 4 original plans a month and I was delayed. I took a little time today to record the problems I encountered recently. The problem is that DrawerLayout is matched with SurfaceView on some mobile phones. Yes, for example, my Samsung test machine (note3 n7506v system: 4.3), but the display is not complete on many mobile phones, such as Meizu Note 2 (5.0) and Huawei (6.0), not not showing, but showing part of it , But the things in the side slide can still be clicked, and it will be displayed after one click. After working for a long time, I didn’t find the problem. Later, I debugged the problem step by step on the SurfaceView. It’s easy to find the problem, here is the solution

drawerlayout.setDrawerListener(new DrawerLayout.SimpleDrawerListener() {@Override public void onDrawerSlide(View drawerView, float slideOffset) {// TODO Auto-generated method stub< /span> super.onDrawerSlide(drawerView, slideOffset); drawerlayout.bringChildToFront(drawerView); drawerlayout.requestLayout();} });

The problem is solved, hereby record it in case you forget it when you use it next time

Leave a Comment

Your email address will not be published.