优化app小建议_lint测试发出的warning

1.Avoid object allocations during draw/layout operations (preallocate and reuse instead)

用Android自带的lint测试,发现上面这个问题。。。。百度一番发现。。。在ondraw/onlayout中尽量不要用new 对象的操作。。。因为ondraw/onlayout会经常被调用;这样比较耗内存。。。。

2.The vertically scrolling ScrollView should not contain another vertically scrolling widget (GridView)

3.Incorrect line ending: found carriage return (\r) without corresponding newline (\n)

4.This LinearLayout should use android:layout_height="wrap_content"

回答:ScrollView children must set their layout_width or layout_height attributes to wrap_content rather than fill_parent or match_parent in the scrolling dimension,ScrollView的子View必须设置他们的宽或者高为wrap_content.

5.The following images appear in both -nodpi and in a density folder: search_play_icon.png, search_ugc_icon_filter.png, volumn_bg.9.png, volumn_front.9.png, volumn_primary.9.png

回答:以下的图片在nodpi中Bitmaps that appear in drawable-nodpi folders will not be scaled by the Android framework. If a drawable resource of the same name appears both in a -nodpi folder as well as a dpi folder such as drawable-hdpi, then the behavior is ambiguous and probably not intentional. Delete one or the other, or use different names for the icons.删除nodpi中的图片,或者定义名字和其他资源包的名字不一样。。。

6.Do not hardcode "/sdcard/"; use Environment.getExternalStorageDirectory().getPath() instead

回答:不要硬编码。。而是要用系统的Environment.getExternalStorageDirectory().getPath()

7.Replace "-" with an "en dash" character (–, –) ?

回答:在string引用文件中把-替换成–

8.This Handler class should be static or leaks might occur 

回答:In Android, Handler classes should be static or leaks might occur. Messages enqueued on the application thread's MessageQueue also retain their target Handler. If the Handler is an inner class, its outer class will be retained as well. To avoid leaking the outer class, declare the Handler as a static nested class with a WeakReference to its outer class.

9.Use new SparseArray<ArrayList<TextView>>(...) instead for better performance

回答:当定义new HashMap<Integer, ArrayList<TextView>>();这个类型时,Android建议

For maps where the keys are of type integer, it's typically more efficient to use the Android SparseArray API. This check identifies scenarios where you might want to consider using SparseArray instead of HashMap for better performance.


This is particularly useful when the value types are primitives like ints, where you can use SparseIntArray and avoid auto-boxing the values from int to Integer.


If you need to construct a HashMap because you need to call an API outside of your control which requires a Map, you can suppress this warning using for example the @SuppressLint annotation.

 














  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: rk_evb1_rk3588_lp4xd200p232sd10h1_v10_20210817_final_lint.brd 是一个电路板设计文件的名称。根据文件名的命名规则,可以推测这是一个由硬件设计团队设计的用于Rockchip公司的EVK(Evaluation Kit)产品的电路板。 根据名称中的一些关键词,我们可以推断出一些关于这个电路板的特点。首先,rk_evb1 表示这是Rockchip EVB系列的第一个版本的电路板。rk3588 意味着这个电路板是为Rockchip公司的RK3588芯片而设计的。LP4XD200P232SD10H1 可能是板载的内存和存储器的规格,可能是基于DDR4 LPDDR4标准的200MHz频率,拥有232GB的存储容量和SD卡插槽。V10 表示这是电路板的第10个版本,20210817 表示该版本是在2021年8月17日完成的。最后的final_lint 可能是指经过逻辑设计和布线的最终版本。 这个电路板可能是用于Rockchip公司的新一代产品的开发和测试。RK3588芯片被广泛应用于高性能计算、人工智能、嵌入式系统等领域,所以这个电路板可能在这些领域中发挥重要的作用。该电路板设计的目的可能是为了验证硬件设计的正确性,并为软件开发团队提供一个可靠的平台进行操作系统、驱动程序和应用程序的开发。 总之,rk_evb1_rk3588_lp4xd200p232sd10h1_v10_20210817_final_lint.brd 是一款由Rockchip公司硬件设计团队设计的用于RK3588芯片的评估板电路板文件,设计用于支持高性能计算、人工智能和嵌入式系统等领域的开发和测试。 ### 回答2: rk_evb1_rk3588_lp4xd200p232sd10h1_v10_20210817_final_lint.brd 这个文件名看起来像是一个 PCB(Printed Circuit Board,印刷电路板)设计文件的命名。根据文件名的后缀 .brd 来推测,它可能是一个 PCB 布局文件。 rk_evb1_rk3588_lp4xd200p232sd10h1_v10_20210817_final_lint.brd 的命名中包含了一些关键信息。rk_evb1 可能是该设计的名称或型号,rk3588 可能是芯片的型号或者主控芯片的代号。lp4xd200p232sd10h1 可能代表了该设计采用了 LPDDR4X 内存、200-pin 接口、232GB 的存储卡、10寸高分辨率屏幕等规格。v10_20210817 可能表示了该 PCB 的版本号和日期,final_lint 则可能是最终进行完整性检查(integrity check)的版本。 PCB 布局文件通常用来指导 PCB 的制造过程。这些文件包含了关于电气连接、线路走向、组件布局、孔洞位置等信息。通过这些文件,制造商可以了解设计者的意图,并确保 PCB 可以按照设计者的要求进行制造。 对于 rk_evb1_rk3588_lp4xd200p232sd10h1_v10_20210817_final_lint.brd,我们可以推测这是一个基于 rk3588 芯片的开发板设计。它采用了 LPDDR4X 内存、232GB 存储卡和高分辨率屏幕。版本号 v10 表示这可能是一个经过多次迭代的设计方案,20210817 表示设计完成的日期。final_lint 意味着这个版本可能已经完成了完整性检查,最终确定为可行的版本。 总之,rk_evb1_rk3588_lp4xd200p232sd10h1_v10_20210817_final_lint.brd 是一个 PCB 布局文件的命名,代表了基于 rk3588 芯片的开发板设计的最终版本。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值