After opening the project
See Mainactivity and Activity_main.xml Find background colors in Activity_main.xml
Recall what the teacher said in the video, you can remove the window color, and then in the mainactivity in the OnCreate method to increase the GetWindow (). setbackgrounddrawable (NULL);
Open the display over paint area in the emulator and run the program
After discovering that the box behind the is Test text is over-drawn, activity_main.xml the area and finds nested multiple linearlayout with the same background color as its parent, the optimized code is as follows:
Click the Overdrawview button to enter overdrawviewactivity
Too much drawing, go into Overdrawview's OnDraw method to view
The more downward the drawing situation, the more serious it is that it can only be drawn to the beginning of the next rectangle.
Change the code to
After running, it is found that there are still over-drawn situations, after thinking will GetWindow (). setbackgrounddrawable (null); Add to Overdrawviewactivityon when you run the program in the Create method
When the above situation is over open Activity_busy_on_draw_view.xml discover nested multi-layer linearlayout run program click Busyondraw
There doesn't seem to be much of an over-drawn situation. The new Paint () of OnDraw in Busyondrawview is conveniently presented.
But nesting multi-layered linearlayout is not good. Similar effects can be implemented using a GridView, continue tomorrow!
Android over-Drawing optimization