This tag and its children can be replaced by ~~~

这是我的布局文件:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="wrap_content"

    android:layout_height="wrap_content"

    android:layout_gravity="center"

    android:gravity="center"

    android:orientation="vertical" >


    <!-- 书封 -->


    <ImageView

        android:id="@+id/listview_grid_layout_iv_bookicon"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_gravity="center"

        android:contentDescription="@null" />

    <!-- 书名 -->


    <TextView

        android:id="@+id/listview_grid_layout_tv_bookname"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_gravity="center" />


</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 ~~~)