Android-通讯录:在群发短信选取联系人界面用到的自定义viewgroup
来源:互联网 发布:淘宝手机助手官网 编辑:程序博客网 时间:2024/06/01 21:53
class MyViewGroup extends ViewGroup {private final static int VIEW_MARGIN = 2;private int maxWidth = 0;private int maxHeight = 60;public MyViewGroup(Context context) {super(context);}protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {for (int index = 0; index < getChildCount(); index++) {final View child = getChildAt(index);child.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);}super.onMeasure(widthMeasureSpec, heightMeasureSpec);}protected void onLayout(boolean arg0, int arg1, int arg2, int arg3, int arg4) {final int count = getChildCount();int row = 0;// which row lay you view relative to parentint lengthX = arg1; // right position of child relative to parentint lengthY = arg2; // bottom position of child relative to parentfor(int i = 0 ; i < count ; i++){final View child = this.getChildAt(i);int width = child.getMeasuredWidth();// int height = child.getMeasuredHeight();int height = maxHeight; //限制子节点的高度lengthX += width + VIEW_MARGIN;lengthY = row * (height + VIEW_MARGIN) + VIEW_MARGIN + height + arg2;if(width + VIEW_MARGIN > maxWidth){maxWidth = width + VIEW_MARGIN;}if(lengthX > arg3){lengthX = width + VIEW_MARGIN + arg1;row ++;lengthY = row * (height + VIEW_MARGIN) + VIEW_MARGIN + height + arg2;}child.layout(lengthX - width, lengthY - height, lengthX, lengthY);}}}
0 0
- Android-通讯录:在群发短信选取联系人界面用到的自定义viewgroup
- android 调用通讯录选取联系人
- android群发短信到通讯录所有联系人上并动态替换其中联系人信息
- android开发步步为营之19:选取手机通讯录中的联系人
- Android 仿微信联系人Demo(自定义View,Viewgroup)
- Android 仿微信联系人Demo(自定义View,Viewgroup)
- android操作通讯录的联系人
- android联系人的简易通讯录
- Android 通讯录添加联系人 自定义电话类型
- Android自定义控件之仿通讯录联系人
- Android 群发短信的实现
- 通讯录添加联系人的界面得到用户在文本框里输入的文字
- 用到gallery的保存自定义联系人
- Android 查询本地通讯录联系人的信息
- Android获取通讯录联系人的正确姿势
- Android通讯录模糊查询搜索(号码,姓名,首字母简拼,全拼),批量选取联系人
- Android通讯录模糊查询搜索(号码,姓名,首字母简拼,全拼),批量选取联系人
- Android 获取通讯录联系人
- GPIO裸机编程
- UVA - 167 The Sultan's Successors(回溯 八皇后问题改编)
- Sort命令详解
- Aspectj中@args使用误解
- Test
- Android-通讯录:在群发短信选取联系人界面用到的自定义viewgroup
- 使用 Tkprof 分析 ORACLE 跟踪文件【转自dave博客】
- android布局属性
- linux静态库的生成与使用
- 目前流行的缺陷管理工具
- 在QML语言中怎么定义signal并怎么正确使用它
- HDU 4950
- 面试必备之:MFC socket编程(浅出+深度:服务端和客户端端口问题)
- 系统启动时,spring配置文件解析失败,报”cvc-elt.1: 找不到元素 'beans' 的声明“异常