自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(14)
  • 资源 (6)
  • 收藏
  • 关注

原创 web实现跑马灯

由于代码比较少,我就写在一个文件里了 //ready(),这个方法在html元素加载完毕才会执行 $(document).ready(function(){ //穿入一个box即可 startInterval($(".box")); function startInterval(box){ var ul = box.find("

2017-02-26 17:28:14 5086

原创 web实现轮播图

html代码

2017-02-26 13:05:56 6911 3

原创 实现侧边栏效果,上拉到一定程度自动停止

全部代码如下: window.onscroll=function(){ var top = document.documentElement.scrollTop||document.body.scrollTop; if(top>650){ var side = document.getElementById("side"); side.

2017-02-23 16:12:54 514

原创 vue路由切换动画

第一步,使用账号注册阿里云图标账号。第二步,创建项目,如图:(1)(2)创建项目第三步:把图标加入购物车,然后添加到项目(1)把图标添加购物车(2添加至项目)最后一步:下载下来解压之后里面有demo,如果对你有帮助,在下面点个赞吧,哈哈

2017-02-22 09:43:46 3467

原创 vue使用mint-ui实现上拉刷新

加上stop方法是解决当鼠标多次触发时的不好体验,比如经过鼠标多次触摸之后,当鼠标停下来,事件还在运行,此时加上stop()即可。$(document).ready(function(){ $(".popup_div").mouseenter(function(){ $(".popup_div").stop().animate({bottom:'0px'},1000,"swi

2017-02-19 22:34:49 1182

原创 web复选框的基础用法

.box{ width: 300px; height: 300px; background: yellow; } $(document).ready(function(){ $("#button").click(function(){ //获得复选框的选择状态 var value = $("#key1").is(":checked

2017-02-28 15:21:17 3397

原创 web常用小技术集合

1,回到顶部效果 $("body").animate({ scrollTop: "0px" }, 700);

2017-02-26 14:53:54 525

原创 web实现左右切换功能

div,ul,li{ margin: 0px; padding: 0px; } .box{ border: 5px solid orange; overflow: hidden; width: 500px; height: 400px; display: inline-block; background: green;

2017-02-24 14:21:57 1150

原创 实现监听下拉具体达到显示和隐藏效果的js的核心代码

var value = false;window.onscroll=function(){ var top = document.documentElement.scrollTop||document.body.scrollTop; if(top > 200){ if(value == false){ $(".search").animate({opacity:'1'},20

2017-02-23 14:05:27 1181

原创 web监听获得滚动值

把如下的代码,放到js文件里即可window.onscroll=function(){ //监听屏幕下拉像素的,就是下拉了多远的距离 var top=document.documentElement.scrollTop||document.body.scrollTop; //输出日志,打印出来数据,在浏览器里查看 console.log(top);}

2017-02-23 12:38:48 666

原创 js设置css属性

$(".class1").mousemove(function(){$(".img1").css('border','solid 1px #C3AC9F');});$(".class1").mouseout(function(){$(".img1").css('border','solid 1px #F1F1F1');});

2017-02-14 22:52:09 1061

转载 块级元素与行内元素(内联元素)的区别和联系

本文出自: http://www.cnblogs.com/Slim-Shady/p/5312913.html在css盒子模型中,我们提到了html元素中的块元素(block element)和内联元素(inline element)。那么它们究竟是什么呢?     其实,这两种元素都是html规范中的概念。块元素(block element)一般是其他元素的容器元素,能容纳其他块元素或

2017-02-13 16:31:37 869

原创 轮播图

http://pan.baidu.com/s/1c2vcKZu

2017-02-11 16:34:11 238

原创 promise的一些使用记录

http://fontawesome.dashgame.com/#basic

2017-02-10 21:34:09 281

网络请求框架Volley

谷歌最近推出的网路请求框架,功能强大,使用简单,只需几行代码即可完成完成网络请求,适用于数据量不大的请求,比如加载图片,JSON,String等,具体使用方法请百度一下吧,很多教程的!

2016-08-13

解析JSON数据的gson库

这是一款出自谷歌公司的Gson库,用来解析JSON数据非常的简单,用法可以参考http://blog.csdn.net/revival_liang/article/details/51819969

2016-07-04

安卓《独立版Mat》内存分析工具

Android Studio自带的内存监控不够强大,所以我们应该选择独立版Mat来弥补这个不足,使用此工具让我们可以更好的分析内存的泄漏问题。

2016-06-20

SwipeListViewTest项目

先来看activity_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:swipe="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" > <com.fortysevendeg.swipelistview.SwipeListView android:id="@+id/example_lv_list" android:layout_width="match_parent" android:layout_height="match_parent" android:listSelector="#00000000" swipe:swipeActionLeft="dismiss" swipe:swipeActionRight="reveal" swipe:swipeAnimationTime="0" swipe:swipeBackView="@+id/back" swipe:swipeCloseAllItemsWhenMoveList="true" swipe:swipeFrontView="@+id/front" swipe:swipeMode="both" swipe:swipeOffsetLeft="0dp" swipe:swipeOffsetRight="0dp" swipe:swipeOpenOnLongPress="false" /> </RelativeLayout> 这里就一个swipelistview控件,我说几个不易理解的属性 表示滑动时的操作,dismiss表示滑动时删除,如果设置为reveal表示滑动时会显示出item后面的选项 swipe:swipeActionLeft=”dismiss” swipe:swipeActionRight=”reveal” 这个是背面布局的id(我们把直接看到的布局叫做前面的,滑动之后才能看到的布局叫做背面的),必须与背面布局id对应 swipe:swipeBackView=”@+id/back” 这个是滚动时候是否关闭背面的布局,true表示关闭,false表示不关闭,一般设置为true swipe:swipeCloseAllItemsWhenMoveList=”true” 这个是前面布局的id,要与布局的id对应 swipe:swipeFrontView=”@+id/front” both表示可以向左滑也可以向右滑,right和left分别表示只能向有或者向左滑动。 swipe:swipeMode=”both” 下面两个表示向左或者向右滑动时的偏移量,一般不在xml文件中设置,而是在代码中根据设置的大小来设置偏移量。 swipe:swipeOffsetLeft=”0dp” swipe:swipeOffsetRight=”0dp” 再来看看Item布局文件,这里包括前面的和后面的,两个重叠在一起: <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <!-- linearlayout中的布局是每一项后面隐藏的布局 --> <LinearLayout android:id="@+id/back" android:layout_width="match_parent" android:layout_height="80dp" android:background="#eee" android:tag="back" > <Button android:id="@+id/example_row_b_action_1" android:layout_width="0dp" android:layout_height="60dp" android:layout_gravity="center" android:layout_marginRight="10dp" android:layout_weight="1" android:text="测试" /> <Button android:id="@+id/example_row_b_action_2" android:layout_width="0dp" android:layout_height="60dp" android:layout_gravity="center" android:layout_marginLeft="10dp" android:layout_weight="1" android:text="删除" /> <Button android:id="@+id/example_row_b_action_3" android:layout_width="0dp" android:layout_height="60dp" android:layout_gravity="center" android:layout_weight="1" android:text="编辑" /> </LinearLayout> <!-- 这里是前台显示的布局 --> <RelativeLayout android:id="@+id/front" android:layout_width="match_parent" android:layout_height="80dp" android:background="#ffffff" android:orientation="vertical" android:tag="front" > <TextView android:id="@+id/example_row_tv_title" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerInParent="true" android:textSize="18sp" /> </RelativeLayout> </FrameLayout> 这个布局是一个常规布局,我就不解释了。 MainActivity.Java,关键地方都有注释 public class MainActivity extends Activity { private SwipeListView mSwipeListView ; private SwipeAdapter mAdapter ; public static int deviceWidth ; private List<String> testData ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mSwipeListView = (SwipeListView) findViewById(R.id.example_lv_list); testData = getTestData(); //数据适配 mAdapter = new SwipeAdapter(this, R.layout.package_row, testData,mSwipeListView); //拿到设备宽度 deviceWidth = getDeviceWidth(); mSwipeListView.setAdapter(mAdapter); //设置事件监听 mSwipeListView.setSwipeListViewListener( new TestBaseSwipeListViewListener()); reload(); } private List<String> getTestData() { String [] obj = new String[]{"红楼梦","西游记","水浒传","管锥编","宋诗选注","三国演义","android开发高级编程","红楼梦","西游记","水浒传","管锥编","宋诗选注","三国演义","android开发高级编程"}; List<String> list = new ArrayList<String>(Arrays.asList(obj)); return list; } private int getDeviceWidth() { return getResources().getDisplayMetrics().widthPixels; } private void reload() { // mSwipeListView.setSwipeMode(SwipeListView.SWIPE_MODE_LEFT); // mSwipeListView.setSwipeActionLeft(SwipeListView.SWIPE_ACTION_REVEAL); // mSwipeListView.setSwipeActionRight(settings.getSwipeActionRight()); //滑动时向左偏移量,根据设备的大小来决定偏移量的大小 mSwipeListView.setOffsetLeft(deviceWidth * 1 / 3); mSwipeListView.setOffsetRight(deviceWidth * 1 / 3); // mSwipeListView.setOffsetRight(convertDpToPixel(settings.getSwipeOffsetRight())); //设置动画时间 mSwipeListView.setAnimationTime(30); mSwipeListView.setSwipeOpenOnLongPress(false); } class TestBaseSwipeListViewListener extends BaseSwipeListViewListener{ //点击每一项的响应事件 @Override public void onClickFrontView(int position) { super.onClickFrontView(position); Toast.makeText(getApplicationContext(), testData.get(position), Toast.LENGTH_SHORT).show(); } //关闭事件 @Override public void onDismiss(int[] reverseSortedPositions) { for (int position : reverseSortedPositions) { Log.i("lenve", "position--:"+position); testData.remove(position); } mAdapter.notifyDataSetChanged(); } } } 数据适配器: public class SwipeAdapter extends ArrayAdapter<String> { private LayoutInflater mInflater ; private List<String> objects ; private SwipeListView mSwipeListView ; public SwipeAdapter(Context context, int textViewResourceId,List<String> objects, SwipeListView mSwipeListView) { super(context, textViewResourceId, objects); this.objects = objects ; this.mSwipeListView = mSwipeListView ; mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder = null ; if(convertView == null){ convertView = mInflater.inflate(R.layout.package_row, parent, false); holder = new ViewHolder(); holder.mFrontText = (TextView) convertView.findViewById(R.id.example_row_tv_title); holder.mBackEdit = (Button) convertView.findViewById(R.id.example_row_b_action_3); holder.mBackDelete = (Button) convertView.findViewById(R.id.example_row_b_action_2); convertView.setTag(holder); }else{ holder = (ViewHolder) convertView.getTag(); } holder.mBackDelete.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //关闭动画 mSwipeListView.closeAnimate(position); //调用dismiss方法删除该项(这个方法在MainActivity中) mSwipeListView.dismiss(position); } }); String item = getItem(position); holder.mFrontText.setText(item); return convertView; } class ViewHolder{ TextView mFrontText ; Button mBackEdit,mBackDelete ; } } 以上就是SwipeListViewTest的用法,希望对你有帮助

2016-05-23

BadgeView提示图标

2016-05-06

SwipeListView

SwipeListView

2016-05-06

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除