1. The XML setcontentview of 30 parts in the example takes up almost 99% of all time before the end of OnCreate () to Onresume ()
Because the overhead of expanding the layout is significant. Try to use a different layout method. For example, reduce the use of a layer of nested linearlayout, using Reltivelayout to place the control on the first layer
Reduce the number of objects created
2, the Activity content view "Father" is a framelayout.
So when the top layer of your XML is just a framelayout, you end up with two framelayout
You can now use <merge> to merge the two layouts
<framelayout xmlns:android= "Http://schemas.android.com/apk/res/android"
Android:layout_width= "Fill_parent"
android:layout_height= "Fill_parent"
Android:id= "@+id/my_top_layout" >
To be replaced by:
<merge xmlns:android= "Http://schemas.android.com/apk/res/android" >
3. Use <include> reuse layouts
4, Viewstub
<viewstub
Android:id= "@+id/mystubid"
Android:inflatedid= "@+id/myid"
android:layout= "@layout/mylayout"/>
This time the layout mylayout will not be Setcontentview expanded
Viewstub stub = (viewstub) Findviewbyid (r.id.mystubid);
View Inflatedview = Stub.inflate ();//inflatedview defined in Mylayout.xml
Viewstub view = (viewstub) Findviewbyid (r.id.mystubid);
View.setvisibility (view.visible); The viewstub is removed from the parent container. Replace with a layout with ID myID
View = Findviewbyid (R.id.myid);
5. Layout Tools
Android comes with a tool, tools directory: Hierarchyviewer.
The layout can only be checked in the simulator. The real machine needs root.
http://blog.csdn.net/autumn_xl/article/details/40741835
Get from get from device 00856cd5d08d2409[viewserverdevice]unable to debug Device:lge- nexus_4-forget from Device 00856cd5d08d2409
Another layoutopt is not found under tools.
6. OpenGL
Android App performance optimization (8th) graphics