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

     

  • 相关阅读:
    C
    数论::整除分块
    洛谷P1262 间谍网络
    洛谷P1649 【[USACO07OCT]障碍路线Obstacle Course】
    HDU2066dijkstra模板题
    Captain Flint and Treasure
    CodeForces
    CodeForces
    HDU-1827
    HDU 1811
  • 原文地址:https://www.cnblogs.com/Free-Thinker/p/3391953.html
Copyright © 2011-2022 走看看