Android短彩信收件人的实现
来源:互联网 发布:电信云计算公司地址 编辑:程序博客网 时间:2024/06/05 01:36
最近因为项目需要开始研究短彩信的收件人这块,因为这块涉及到的东西比较多,所以还是静下心来一点一点啃,希望早日成佛啊。。。
首先从收件人的布局开始说,信息的编辑界面布局文件compose_message_activity.xml,
<ViewStub android:id="@+id/recipients_editor_stub" android:layout="@layout/recipients_editor" android:layout_width="match_parent" android:layout_height="wrap_content" />
从上边能看出收件人的具体内容还是在recipient_editor.xml中,接着看这个布局文件,文件内容不多,由一个自定义的view和ImageButton组成:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal"> <com.android.mms.ui.RecipientsEditor android:id="@+id/recipients_editor" android:hint="@string/to_hint" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textFilter" android:layout_weight="1" android:textColor="@color/compose_message_edit_text" /> <ImageButton android:id="@+id/recipients_picker" android:src="@mipmap/ic_launcher_contacts" android:layout_marginLeft="5dip" android:layout_width="50dip" android:layout_height="fill_parent" android:layout_weight="0" android:background="@null" /></LinearLayout>
上面只是简单的布局文件,下面进入主题,讲解下收件人框的自定义布局com.android.mms.ui.RecipientsEditor
RecipientsEditor.java继承了RecipientEditTextView,通过进一步查看代码可知RecipientsEditor其实就是继承了MultiAutoCompleteTextView,在MultiAutoCompleteTextView里其实已经定义好了收件人自动匹配的的基本功能,在RecipientEditor只是重新对它又做了一些封装而已。
下面首先讲下收件人的显示:
Bitmap.createBitmap()创建点击图片
handlePendingChips-->createReplacementChip()-->constructChipSpan()-->createUnselectedChip()-->Bitmap.createBitmap()
expand()和shrink()方法比较经常被调用,当点中RecipientsEditor的时候,其获得焦点,调用expand()方法,将chips展开,而RecipientsEditor失去焦点的时候,调用shrink(),将chips收缩,只显示最开始的两个联系人
点击删除按钮:
RecipientEditTextView.java
onTouchEvent()方法中onClick()-->removeChip()
- Android短彩信收件人的实现
- android短彩信相关
- 短彩信限制功能实现
- Android 短彩信数据模型介绍
- android短彩信附件机制
- Android 短彩信数据模型介绍
- Android 短彩信数据模型介绍
- Android短彩信数据库研究
- Android 短彩信数据模型介绍
- Android 短彩信数据模型介绍
- android短彩信附件机制
- 【android】短彩信相关bug
- 【android】短彩信相关bug
- Android短彩信数据库解析
- Android短彩信数据库解析
- Android短彩信数据库解析
- Android短彩信数据库解析
- Android 短彩信数据模型介绍
- qsort 三级排序
- Android AOSP输入法(LatinIME)输入流程二
- 实体,泛型
- 哈工大操作系统实验2—系统接口
- 各种排序算法的分析及java实现
- Android短彩信收件人的实现
- 黑马程序员——基础学习(七)Eclipse相关应用及引用类型问题
- Android控件详解之EditText
- 解决 Ubuntu 14.04 无法调节屏幕亮度的问题
- CSU 1506 Double Shortest Paths(最小费用流)
- icvCreateHaarTrainingData源码详细分析
- Hadoop DistributedCache使用及原理
- iOS --- UIColor中使用16进制选取颜色
- linux yum命令详解