eclipse提示:This tag and its children can be replaced by one <TextView/> and a compound drawable
今天在学习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
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
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...
- android xml文件中出现如下提醒:This tag and its children can be replaced by one <TextView/> and a compound drawable
第一个感叹号 是跟你说 让你把Imageview 和textview 结合起来 只用 textview textview有个属性叫 android:drawable...(top/bottom/.. ...
- Eclipse提示Tomcat miss丢失bug:The Tomcat server configuration at \Servers\Tomcat v5.5 Server at localhost-config is missing.
Eclipse提示Tomcat miss丢失bug:The Tomcat server configuration at \Servers\Tomcat v5.5 Server at localhos ...
- java工程项目里,在一个包里面,不能出现同名的类名,这问题是刚接触java才会遇到的,特别是新手一般都没有建立包,而是使用默认的,易出现同名的类名,导致eclipse提示错误
java工程项目里,在一个包里面,不能出现同名的类名,这问题是刚接触java才会遇到的,特别是新手一般都没有建立包,而是使用默认的,易出现同名的类名,导致eclipse提示错误. 问题: 创建了一个工 ...
- Ubuntu12.04下eclipse提示框黑色背景色的修改方法
eclipse提示框的背景颜色使用的是系统的提示框颜色配置,在windows下为黄色,但在Ubuntu12.04(gnome)下却是黑色,造成提示内容很难看清. 在eclipse中我们是无法修改这个颜 ...
- 导入Maven项目后,Eclipse提示“Missing artifact ”类的错误
导入Maven项目后,Eclipse提示“Missing artifact ”类的错误 标签: Maven Missing art 2016-08-15 16:05 679人阅读 评论(0) 收藏 举 ...
- Ubuntu——修正LibreOffice中文乱码以及eclipse提示框颜色
刚进ubuntu的时候就老遇到用libreoffice打开某些文档时出现一堆叠在一起的乱码.以及最開始使用eclipse编辑时,鼠标放到一个变量或者函数时 弹出来一黑框框-看的难受的.... 这里记录 ...
- [转载]Eclipse提示No java virtual machine
第一次运行Eclipse,经常会提示下面的问题:... No java virtual machine was found after searching the follwing location ...
- Ubuntu 14.04 eclipse 提示框背景色更改
首先查看系统设置->外观->主题. 不同的主题需要更改的文件不同 sudo vim /usr/share/themes/主题(就是刚才主题的名字,ubuntu14.04默认是Ambianc ...
随机推荐
- Ajax基础知识《一》
对于网站开发人员,一定不会陌生的Ajax技术,本篇就让我们认识一下它,或许在日后的开发过程中我们就可以使用到.Ajax在那方面使用的比较多呢?答案:表单注册,传统的表单注册,有时需要填写大量的信息,当 ...
- 希望有兴趣的加入,共同为项目智能化管理jar包而努力 第二篇
想听听大家对于我这个想法的一些看法,喷也好,赞也罢,希望留下您宝贵的建议! 有共同想法并且想实现的请入群 2500261120 在使用autort插件时,首先要到autort服务器下载所有 ...
- Webydo:一款在线自由创建网站的 Web 应用
Webydo 是一款专业的在线建站应用,使平面设计师可以创建和管理 HTML 网站,而无需编写代码.设计人员可以设计任何类型网站,只需要点击按钮,就能够发布先进的 HTML 网站. 你可以控制所有的设 ...
- nodejs操作mongodb
一.下载地址 https://www.mongodb.com/download-center#community 二.控制台操作mongodb 1.安装完后添加环境变量. 2.在某个根目录下新建dat ...
- js每天进步一点点4
输入数字的验证
- GDB 和 windbg 命令对照(转载)
From:http://blog.csdn.net/joeleechj/article/details/10020501 命令 ...
- SQL Server安全(1/11):SQL Server安全概述
在保密你的服务器和数据,防备当前复杂的攻击,SQL Server有你需要的一切.但在你能有效使用这些安全功能前,你需要理解你面对的威胁和一些基本的安全概念.这篇文章提供了基础,因此你可以对SQL Se ...
- 简单认识C#
C#浅解众所周知c#是微软推出的一款完全没面向对象的编程语言,那么对象是什么?在现实生活中人们一提到对象首先想到的就是“情侣”!但是在我们的程序中对象是什么? 在程序中个能够区别于其他事物的独立个体我 ...
- 浅谈 block(1) – clang 改写后的 block 结构
这几天为了巩固知识,从 iOS 的各个知识点开始学习,希望自己对每一个知识理解的更加深入的了解.这次来分享一下 block 的学习笔记. block 简介 block 被当做扩展特性而被加入 GCC ...
- [锋利的JQ]-超链接提示效果
关键知识点: 1.事件对象:当事件一旦被触发,事件对象便会创立.事件对象只能作用于该事件的事件处理程序. 2.认识了mousemove事件了连续触发执行的特性. 代码: HTML: <div c ...