Android 开发 Tip 15 -- can be replaced by one <TextView/> and a compound drawable

本文介绍了Android开发中的一个优化技巧,当XML布局中紧邻的<ImageView/>和<TextView/>可以被一个<TextView/>替换,通过使用compound drawable属性达到相同效果,从而减少布局层级,提升性能。
摘要由CSDN通过智能技术生成

转载请注明出处:http://blog.csdn.net/crazy1235/article/details/72526781


 This tag and its children can be replaced by one <TextView/> and a compound drawable

当xml布局文件中,出现两个紧挨着的 <ImageView /> <TextView />,IDE就会给出这样一个提示!

意思就是可以通过一个 <TextView /> 控件,然后设置 compound drawable 属性来替代完成!

比如:

<LinearLayout   
       android:orientation
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值