Android 节点可以替换为一个;TextView";带复合抽绳
我刚刚开始android开发。使用布局编辑器,我在TextView下面添加了一个图像视图。 添加TextView后,会打印以下警告:Android 节点可以替换为一个;TextView";带复合抽绳,android,xml,Android,Xml,我刚刚开始android开发。使用布局编辑器,我在TextView下面添加了一个图像视图。 添加TextView后,会打印以下警告: Node view can be replaced by a "TextView" with compound drawables This tag and its children can be replaced by one <TextView/> and a compound drawable A LinearLayout
Node view can be replaced by a "TextView" with compound drawables
This tag and its children can be replaced by one <TextView/> and a compound drawable A LinearLayout which contains an ImageView and a TextView can be more efficiently handled as a compound drawable (a single TextView, using the drawableTop, drawableLeft, drawableRight and/or drawableBottom attributes to draw one or more images adjacent to the text). If the two widgets are offset from each other with margins, this can be replaced with a drawablePadding attribute. There's a lint quickfix to perform this conversion in the Eclipse plugin. Issue id: UseCompoundDrawables
节点视图可以替换为具有复合绘图功能的“TextView”
此标记及其子标记可以替换为一个和一个复合的可绘制线性布局,其中包含ImageView和TextView,可以更有效地作为复合可绘制进行处理(单个TextView,使用drawableTop、drawableLeft、drawableRight和/或drawableBottom属性绘制与文本相邻的一个或多个图像)。如果这两个小部件之间有边距偏移,则可以用drawablePadding属性替换。Eclipse插件中有一个lint快速修复程序来执行此转换。问题编号:UseCompoundDrawables
请帮我解决这个问题。谢谢你警告说“可替换为”不“应替换为”。所以你可以忽略它。并非每个ImageView
和TextView
组合都可以被CompoundDrawables
替换。即使这样,如果你想知道,如何做到这一点,请告诉我,我已经在下面描述了
TextView
标签附带4个复合绘图功能,分别用于左侧
、顶部
、右侧
和底部
只需将下面的行添加到您的文本视图
android:drawablelft=“@drawable/up\u count\u big”
或者在java代码中,您可以这样做:-
mTextView.setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom);
其中左侧
,顶部
,右侧
和底部
都是可绘制的
有关更多信息,请参阅