您的位置:首页 > 其它

This tag and its children can be replaced by one <TextView/> and a compound drawable

2013-10-28 10:36 627 查看
写了这么一段代码:

<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等属性指定!

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐