- Pre-scale your views
- Use Adaptors
- don't use invalidate() - use a specific Rect or region. Use Developer Settings, show screen redraw tools on the device/emulator
- look at the view hierarchy in the emulator --- avoid deep trees --- wide trees are preferred.
- emulator shows the rendering time, layout time, etc
- Compound drawables - collapse views/levels in the view hierarchy (e.g. images adjacent to text)
- ViewStub -- hidden portions- keeps UI views to a minimum (review the Android source code for examples)
- use the
tag instead of a dummy frame or layout node/tag --- again, always avoid hierarchy levels, use the tag to be the root in xml - Use RelativeLayouts instead of linear layouts
- Try using Custom View and Layout children from the Base classes --- rather than expand the hierarchy by nesting standard layouts
- Standard java performance stuff --- watch GC, allocations (Allocation Tracker tool) String, understand Soft,Weak References
Wednesday, October 28, 2009
Android UI Tricks and Tips for Performance
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment