layoutopt用法

android sdk提供了对Android项目布局的优化分析工具layoutopt命令。例如:我的项目,在workspace下, w+$~ ds  
首 先,进入sdk的tools目录下,输入命令layoutopt+项目目录(例如,xp环境下为C:/workspace/;Linux环境下为 workspace/)+工程名字+res+layout+(这里可继续到指定的目录下,也可以指定具体的xml文件,也可以不写) 7^<6 |>j4  
例子: "�c+$GS  
0:JNkXZ:  
O l;DJV  
这是我在xp环境下,运行layoutopt命令检查C:/workspace/android.welcomeDemo/res/layout/目录下两个xml文件。 g3 Oro}wt6  
DFvGc`O4  
8:17 This LinearLayout layout or its LinearLayout parent is useless表示的意思第8行,提示未使用到的布局 H5*#=It  
15:15 Use an android:layout_height of 0dip instead of wrap_content for better performance表示的意思是第15行,android:layout_height最好使用0dip替换掉之前的wrap_content R_b4S%jhx  
<ListView android:id="@+id/list" android:layout_width="fill_parent" ^6J*:(eM  
            android:layout_height="0dip" android:layout_weight="10" >+DM TV[O  
            android:drawSelectorOnTop="true" /> F/^/,hy  
还有一些常见的: Z5 7.+z<  
7:23 The root-level <FrameLayout/> can be replaced with <merge/>提示建议替换标签 %cBOi_}}~  
-1:-1 This layout has too many nested layouts: 13 levels, it should have <= 10!提示过多的嵌套布局 [SD mdr1T$  
tEt46]{  
-1:-1 This layout has too many views: 81 views, it should have <= 80! samples/useless.xml提示在一个布局中过多的视图组件。 t+K1ArQc  
更多详细信息:http://androidappdocs.appspot.com/guide/developing/tools/layoutopt.html , U)&ny  
[pre]$ layoutopt samples / !a25cm5ys  
samples
/ compound . xml TZGk[u^*  
  
7 : 23 The root - level < FrameLayout /> can be replaced with < merge /> +v$W$s&b-h  
  
11 : 21 This LinearLayout layout or its FrameLayout parent is useless R+_!FnOJ  
samples
/ simple . xml #c":y5:  
  
7 : 7 The root - level < FrameLayout /> can be replaced with < merge /> 9C=*>I27?  
samples
/ too_deep . xml o 0T1pGs'  
  
- 1 :- 1 This layout has too many nested layouts : 13 levels , it should have <= 10 ! EJRkFn8XG'  
  
20 : 81 This LinearLayout layout or its LinearLayout parent is useless aGfp"NtL  
  
24 : 79 This LinearLayout layout or its LinearLayout parent is useless RWX!d54&  
  
28 : 77 This LinearLayout layout or its LinearLayout parent is useless z"mpwmv5  
  
32 : 75 This LinearLayout layout or its LinearLayout parent is useless /�q3ui}-9  
  
36 : 73 This LinearLayout layout or its LinearLayout parent is useless "RM/<)IF  
  
40 : 71 This LinearLayout layout or its LinearLayout parent is useless @rAV;D%  
  
44 : 69 This LinearLayout layout or its LinearLayout parent is useless k{=dV  
  
48 : 67 This LinearLayout layout or its LinearLayout parent is useless 1 3w(Tf  
  
52 : 65 This LinearLayout layout or its LinearLayout parent is useless H5�& ._  
  
56 : 63 This LinearLayout layout or its LinearLayout parent is useless uubIL +  
samples
/ too_many . xml aWH  
  
7 : 413 The root - level < FrameLayout /> can be replaced with < merge /> pPag@L  
  
- 1 :- 1 This layout has too many views : 81 views , it should have <= 80 ! .G vk5Wn  
samples
/ useless . xml Lk P :l  
  
7 : 19 The root - level < FrameLayout /> can be replaced with < merge /> Cl!(F 6K*  
  
11 : 17 This LinearLayout layout or its FrameLayout parent is useless
[/pre]

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值