欢迎光临成都祈钰瑶科技有限公司网站!祝您生活愉快!
热线电话: 18982081108
✕

成都服务器托管,成都GPU服务器租用,成都高防BGP宽带租用,成都机柜租用托管

AndroidTextView实现图文混合编排的方法-创新互联

本文实例为大家分享了Android TextView图文混合编排的具体代码,供大家参考,具体内容如下

成都创新互联公司专业为企业提供罗源网站建设、罗源做网站、罗源网站设计、罗源网站制作等企业网站建设、网页设计与制作、罗源企业网站模板建站服务,10多年罗源做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。

实现技术细节不难,两个要点:


1、html代码的混合编写。
2、重写ImageGetter。

例如:


布局:


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:orientation="vertical"
 tools:context="zhangphil.app.MainActivity">

 <TextView
 android:id="@+id/text1"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content" />

 <TextView
 android:id="@+id/text2"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content" />

 <TextView
 android:id="@+id/text3"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:ellipsize="end"
 android:maxLines="1" />

 <TextView
 android:id="@+id/text4"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:ellipsize="end"
 android:maxLines="1" />
</LinearLayout>