这是我的布局文件:

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



更多相关文章

  1. Android的日积月累-问题解决
  2. Android(安卓)JUnit单元测试基础实例
  3. Android(安卓)APP 启动优化(冷启动)
  4. android软键盘遮挡布局
  5. android > ListView > 加载 网络/assets图片
  6. Android(安卓)TTS实现简单阅读器(一)
  7. Android(安卓)软键盘顶起布局相关
  8. Android(安卓)程序 LinearLayout布局 参数layout_weight 探讨
  9. 《Android(安卓)UI基础教程》之读书笔记

随机推荐

  1. Android工具库
  2. Android 6.0 Ethernet流程分析记录
  3. 如何让Android横竖屏切换时不销毁当前act
  4. Android中一些比较好的开源代码项目
  5. Android(安卓)Service的启动流程源码分析
  6. 【Android】安卓中常用的图片加载方法
  7. android monkeyrunner 1
  8. Android应用程序组件Content Provider应
  9. Android获取设备状态栏status bar高度的
  10. What is Android?