Android仿微信SlideView聊天列表滑动删除效果
package com.ryg.slideview; import com.ryg.slideview.MainActivity.MessageItem;
//Download by http://www.okbase.net
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ListView; public class ListViewCompat extends ListView { private static final String TAG = "ListViewCompat"; private SlideView mFocusedItemView; public ListViewCompat(Context context) {
super(context);
} public ListViewCompat(Context context, AttributeSet attrs) {
super(context, attrs);
} public ListViewCompat(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
} public void shrinkListItem(int position) {
View item = getChildAt(position); if (item != null) {
try {
((SlideView) item).shrink();
} catch (ClassCastException e) {
e.printStackTrace();
}
}
} @Override
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: {
int x = (int) event.getX();
int y = (int) event.getY();
int position = pointToPosition(x, y);
Log.e(TAG, "postion=" + position);
if (position != INVALID_POSITION) {
MessageItem data = (MessageItem) getItemAtPosition(position);
mFocusedItemView = data.slideView;
Log.e(TAG, "FocusedItemView=" + mFocusedItemView);
}
}
default:
break;
} if (mFocusedItemView != null) {
mFocusedItemView.onRequireTouchEvent(event);
} return super.onTouchEvent(event);
} }
Android仿微信SlideView聊天列表滑动删除效果的更多相关文章
- 微信小程序实现滑动删除效果
在一些app中,随处可见左滑动的效果,在微信小程序中,官方并未提供相关组件,需要我们自己动手写一个类似的效果 下面仅列举出核心代码,具体的优化需要根据你自身的需求 <view class='li ...
- 转-Android仿微信气泡聊天界面设计
微信的气泡聊天是仿iPhone自带短信而设计出来的,不过感觉还不错可以尝试一下仿着微信的气泡聊天做一个Demo,给大家分享一下!效果图如下: 气泡聊天最终要的是素材,要用到9.png文件的素材,这样气 ...
- Android仿微信气泡聊天界面设计
微信的气泡聊天是仿iPhone自带短信而设计出来的,不过感觉还不错可以尝试一下仿着微信的气泡聊天做一个Demo,给大家分享一下!效果图如下: 气泡聊天最终要的是素材,要用到9.png文件的素材,这样气 ...
- Android listview 侧滑 SwipeListView 详解 实现微信,QQ等滑动删除效果
转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/28508769 今天看别人项目,看到别人使用了SwipeListView,Goog ...
- SwipeListView 具体解释 实现微信,QQ等滑动删除效果
转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/28508769 今天看别人项目,看到别人使用了SwipeListView,Goog ...
- SwipeListView 详解 实现微信,QQ等滑动删除效果
转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/28508769 今天看别人项目,看到别人使用了SwipeListView,Goog ...
- 【转】Android 实现ListView的滑动删除效果
http://www.cnblogs.com/weixiao870428/p/3524055.html http://download.csdn.net/download/love_javc_you/ ...
- mui 列表项左右滑删除功能升级(仿微信左滑 点击删除后出现确认删除)
mui 列表项左右滑删除功能升级(仿微信左滑 点击删除后出现确认删除) 2018-06-19更新显示样式
- Android 编程下代码之(QQ消息列表滑动删除)
这份代码写出来有些时候了,一直没共享,现在把它共享给大家.简单列一下代码中你可以学到的知识点: 自定义控件的实现方式: 事件的拦截分发消费机制: QQ会话列表滑动删除原理: 最后附上源码链接:Q ...
随机推荐
- C#中对于可变性的限制
发现很少有集中讨论C#可变性限制的中文博文(要么就是一大段文字中夹杂很多凌乱的部分),所以写发篇博文,集中讨论,这些限制基本是基于安全考虑,亦或者根本难以实现而产生的. 注:本文不再解释什么是可变性, ...
- Linux查看当前系统登录用户、登录日志、登录错误日志
1.查看当前系统的登录用户 w who 2.查看成功登录历史记录 last -n 3.查看尝试登录失败的历史记录 lastb -n 4.显示每个用户最近一次登录成功的信息 lastlog
- 利用mysql中的SQL_CALC_FOUND_ROWS 来实现group by后的记录数统计
最近正在做一个显示消息的列表页,列表页中需要根据一个字段来分组显示.并且需要一个分页的效果. 大家也知道group by 后的数据是每一组一行记录,统计分组后的总的记录数又不能用count,所以SQL ...
- centos could not retrieve mirrorlist
centos could not retrieve mirrorlist >>>>>>>>>>>>>>>> ...
- 第一篇:杂项之pymysql连接池
杂项之pymysql连接池 杂项之pymysql连接池 本节内容 本文的诞生 连接池及单例模式 多线程提升 协程提升 后记 1.本文的诞生 由于前几天接触了pymysql,在测试数据过程中,使用普 ...
- PHP程序漏洞产生的原因和防范方法
滥用include 1.漏洞原因: Include是编写PHP网站中最常用的函数,并且支持相对路径.有很多PHP脚本直接把某输入变量作为Include的参数,造成任意引用脚本.绝对路径泄露等漏洞.看以 ...
- 一个实例明白AutoResetEvent和 ManulResetEvent的用法
先看一段代码: public class WaitHandlerExample { public static AutoResetEvent waitHandler; ...
- 前端----表格的具体使用(jquery)
表格在页面布局中常常会用到.在不同的框架中有不同的使用方法,现在,我先总结下表格在jquery中具体使用: 1.增--insertAfter() function addTr(){ $("& ...
- SQL SERVER排序函数
排名函数是SQL Server2005新加的功能.在SQL Server2005中有如下四个排名函数: 1.row_number 2.rank 3.dense_rank 4.ntile 下面分别介绍一 ...
- sql server获取当前日期
SqlServer中得到当前日期(convert函数,getdate函数)函数GETDATE()的返回值在显示时只显示到秒.实际上,SQL Sever内部时间可以精确到毫秒级(确切地说,可以精确到3. ...