这是个人布局文件:android
<?xml version="1.0" encoding="utf-8"?>eclipse
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"布局
android:layout_width="wrap_content"spa
android:layout_height="wrap_content"orm
android:layout_gravity="center"xml
android:gravity="center"图片
android:orientation="vertical" >ip
<!-- 书封 -->utf-8
<ImageViewit
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等属性指定。