eclipse提示:This tag and its children can be replaced by one <TextView/> and a compound drawable
来源:互联网 发布:起点09服饰淘宝店 编辑:程序博客网 时间:2024/06/05 21:03
今天在学习android开发的时候,写了这样的一段代码:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:gravity="center" > <ImageView android:id="@+id/imageview2" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" /></LinearLayout>
然后eclipse就报出提示:This tag and its children can be replaced by one <TextView/> and a compound drawable
最后查了一下资料发现:
有时候我们可能会用image+textview组合,但其实image是没必要的,textview提供了一个属性来给它设置image
如:通过 setCompoundDrawable 方法, 或者直接在xml中使用android:drawableLeft.、android:drawableRight等属性指定!
其他:
- Set android:baselineAligned="false" on this element for better performance
- 如果LinearLayout被用于嵌套的layout空间计算,它的android:baselineAligned属性应该设置成false,以加速layout计算
- android:baselineAligned="false"
- This LinearLayout layout or its RelativeLayout parent is useless;
- 多余的Linearlayout或者RelativeLayout
- 删除即可
- Use a layout_height of 0dip instead of wrap_content for better performance
- 当在一个linearlayout布局中为一个控件设置weight属性时,这个组件会默认填充剩余空间
- 去掉weight属性或者修改wrap_content为0dp
- Buttons in button bars should be borderless
- 原因未知
- style="?android:attr/buttonBarButtonStyle"
资料摘自:http://www.tuicool.com/articles/YvMjEz
http://blog.csdn.net/feng88724/article/details/7638511
0 0
- eclipse提示:This tag and its children can be replaced by one <TextView/> and a compound drawable
- This tag and its children can be replaced by one <TextView/> and a compound drawable
- This tag and its children can be replaced by one <TextView/> and a compound drawable
- This tag and its children can be replaced by one <TextView/> and a compound drawable
- This tag and its children can be replaced by one <TextView/> and a compound drawable
- This tag and its children can be replaced by one <TextView/> and a compound drawable
- android This tag and its children can be replaced by one <TextView/> and a compound drawable 布局文件提示
- 【Android学习笔记】This tag and its children can be replaced by one <TextView/> and a compound drawable
- 关于 This tag and its children can be replaced by one <TextView/> and a compound drawable 的问题
- Android 开发 Tip 15 -- can be replaced by one <TextView/> and a compound drawable
- This tag and its children can be replaced
- Illegal use of <when>-style tag without <choose> as its direct parent
- Illegal use of <when>-style tag without <choose> as its direct parent
- Illegal use of <when>-style tag without <choose> as its direct parent
- A. Jzzhu and Children
- A. Jzzhu and Children
- This can be the result of a merge and the unknown UUID is being discarded.
- 1075 - Incorrect table definition;there can be only one auto column and it must be defined as a key
- 一些脚本工具
- Android:onNewIntent()触发机制及注意事项
- #Objective - C - Eighth-day 内存管理总结
- Oracle PLSQL Developer安装配置
- myeclipse安装后要做的几件事
- eclipse提示:This tag and its children can be replaced by one <TextView/> and a compound drawable
- iOS小问题--使用NSPredicate比较两个数组中相同(不同)的元素
- SpringMVC断言--Assert
- linux ftp服务器搭建 虚拟用户
- Spring-boot 配置Aop获取controller里的request中的参数以及其返回值
- javaweb必会_网页验证码制作
- CocoaPods 工程管理,经验总结,进阶
- ESXi OEM版本下载地址
- C++标准库 (头文件中文翻译)