This tag and its children can be replaced by one and a compound drawable

写了这么一段代码:

    <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 <TextView/> and a compound drawable


你可能感兴趣的:(textview)