zoukankan      html  css  js  c++  java
  • This tag and its children can be replaced by one <TextView/> and a compound drawable

    写了这么一段代码:

    1.    <LinearLayout   
    2.        android:orientation="horizontal"  
    3.        android:layout_centerInParent="true"  
    4.     android:layout_height="wrap_content"  
    5.     android:layout_width="wrap_content">  
    6.     <ImageView   
    7.         android:id="@+id/grid_icon"  
    8.         android:layout_width="wrap_content"  
    9.         android:layout_height="wrap_content"/>  
    10.     <TextView  
    11.         android:id="@+id/grid_text"  
    12.         android:layout_height="wrap_content"  
    13.         android:layout_width="wrap_content"  
    14.         android:text="@string/app_name"/>  
    15. </LinearLayout>  


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

    最后发现原来可以直接给TextView加图片.. ,通过 setCompoundDrawable 方法, 或者直接在xml中使用android:drawableLeft.、android:drawableRight等属性指定!

     

  • 相关阅读:
    循序渐进学习栈和队列
    循序渐进学习数据结构之线性表
    2018 noip 备战日志
    2018 noip 考前临死挣扎
    二维前缀和与差分
    noip模板复习
    宽搜总结
    强联通总结
    二分图再次总结
    NOIP 2016 换教室(期望dp)
  • 原文地址:https://www.cnblogs.com/Free-Thinker/p/3391953.html
Copyright © 2011-2022 走看看