本文主要是介绍This tag and its children can be replaced by one and a compo,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
写了这么一段代码:
<LinearLayout android:orientation="horizontal" android:layout_centerInParent="true" android:layout_height="wrap_content" android:layout_width="wrap_content"> <ImageView android:id="@+id/grid_icon" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:id="@+id/grid_text" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/app_name"/> </LinearLayout>
eclipse提示: This tag and its children can be replaced by one <TextView/> and a compound drawable
最后发现原来可以直接给TextView加图片.. ,通过 setCompoundDrawable 方法, 或者直接在xml中使用android:drawableLeft.、android:drawableRight等属性指定!
这篇关于This tag and its children can be replaced by one and a compo的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!