码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2015-04-29 13:13:57      阅读:233      评论:0      收藏:0      [点我收藏+]

标签:

 

技术分享
 1 <?xml version="1.0" encoding="utf-8"?>
 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     android:layout_width="fill_parent"
 4     android:layout_height="wrap_content"
 5     android:orientation="horizontal" >
 6     
 7     <ImageView 
 8         android:src="@drawable/ic_launcher"
 9         android:layout_width="wrap_content"
10         android:layout_height="wrap_content"
11         android:contentDescription="@drawable/ic_launcher"/>
12     
13     <TextView 
14         android:id="@+id/list_item_textview"
15         android:layout_width="wrap_content"
16         android:layout_height="fill_parent"
17         android:paddingLeft="20dp"/>
18 
19 </LinearLayout>
View Code

如果图片是直接引用drawable中的图片资源,可以直接在TextView中定义,

可直接替换为:

技术分享
 1 <?xml version="1.0" encoding="utf-8"?>
 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     android:layout_width="fill_parent"
 4     android:layout_height="wrap_content"
 5     android:orientation="horizontal" >
 6     
 7     <TextView 
 8         android:id="@+id/list_item_textview"
 9         android:layout_width="wrap_content"
10         android:layout_height="fill_parent"
11         android:drawableLeft="@drawable/ic_launcher"
12         android:drawablePadding="20dp"/>
13 
14 </LinearLayout>
View Code

 

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

标签:

原文地址:http://www.cnblogs.com/luow/p/4465434.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!