ANDROID DEVELOPERS – OPTIMIZE YOUR LAYOUTS

13 Dec, 2009  |  Written by admin  |  under Google Phone

This ikon has no alt text

“Writing individual programme layouts for Android applications is easy, but it crapper sometimes be arduous to behave them. Most often, onerous modifications prefabricated to existing XML layouts, same reordering views around or dynamical the identify of a container, advance to inefficiencies that go unnoticed.

Starting with the SDK Tools Revision 3 you crapper ingest a agency titled layoutopt to automatically notice ordinary problems. This agency is currently exclusive acquirable from the bidding distinction and its ingest is rattling ultimate – meet unstoppered a tangency and start the layoutopt bidding with a itemize of directories or XML files to analyze:

$ layoutopt samples/
samples/compound.xml
  7:23 The root-level <FrameLayout/> crapper be replaced with <merge/>
  11:21 This LinearLayout layout or its FrameLayout parent is junked samples/simple.xml
  7:7 The root-level <FrameLayout/> crapper be replaced with <merge/>
samples/too_deep.xml
  -1:-1 This layout has likewise whatever nested layouts: 13 levels, it should hit <= 10!
  20:81 This LinearLayout layout or its LinearLayout parent is useless
  24:79 This LinearLayout layout or its LinearLayout parent is useless
  28:77 This LinearLayout layout or its LinearLayout parent is useless
  32:75 This LinearLayout layout or its LinearLayout parent is useless
  36:73 This LinearLayout layout or its LinearLayout parent is useless
  40:71 This LinearLayout layout or its LinearLayout parent is useless
  44:69 This LinearLayout layout or its LinearLayout parent is useless
  48:67 This LinearLayout layout or its LinearLayout parent is useless
  52:65 This LinearLayout layout or its LinearLayout parent is useless
  56:63 This LinearLayout layout or its LinearLayout parent is useless
samples/too_many.xml
  7:413 The root-level <FrameLayout/> crapper be replaced with <merge/>
  -1:-1 This layout has likewise whatever views: 81 views, it should hit <= 80! samples/useless.xml
  7:19 The root-level <FrameLayout/> crapper be replaced with <merge/>
  11:17 This LinearLayout layout or its FrameLayout parent is useless

For apiece analyzed file, the agency module inform the distinction drawing of apiece attach that could potentially be optimized. In whatever cases, layoutopt module also substance a doable solution.
The underway edition of layoutopt contains a dozen rules utilised to dissect your layout files and forthcoming versions module allow more. Future plans for this agency also allow the knowledge to create and ingest your possess psychotherapy rules, to automatically add the layouts with optimized XML, and to ingest it from within Eclipse and/or a standalone individual interface.”
[Via Android Developers]

No Responses so far | Have Your Say!

Comments are closed.