安卓 listview 拖动 源码

时间:2020-10-11 05:15:44
【文件属性】:

文件名称:安卓 listview 拖动 源码

文件大小:1.04MB

文件格式:ZIP

更新时间:2020-10-11 05:15:44

安卓 listview 拖动 源码

package com.czl.struct.activity; import java.util.ArrayList; import java.util.HashMap; import android.os.Bundle; import android.view.Menu; import com.czl.struct.R; import com.czl.struct.adapter.DemoAdapter; import com.czl.struct.interfaces.DragItemChangeListener; import com.czl.struct.widget.DragListView; public class MainActivity extends BaseActivity implements DragItemChangeListener{ private DragListView dragListView; private ArrayList> list; private DemoAdapter demoAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); init(); findViewById(); } @Override public void init() { list = new ArrayList>(); for (int i = 0; i < 20; i++) { HashMap map = new HashMap(); map.put("numbTV", "D138026594664912200" + i); map.put("adrTv", "浙江省杭州市西湖区小和山"); map.put("timeTv", "2013-09-27 15:23"); map.put("callTv", "18778900578"); list.add(map); } } @Override public void findViewById() { dragListView = (DragListView) findViewById(R.id.dragLvi); demoAdapter = new DemoAdapter(MainActivity.this, list); dragListView.setAdapter(demoAdapter); dragListView.setDragImageSourceId(R.id.imageView1); dragListView.setDragItemChangeListener(this); } @Override public void Message(android.os.Message msg) { } @Override public void onDragItemChange(int dragSrcPosition, int dragPosition) { HashMap map = list.get(dragSrcPosition); list.remove(dragSrcPosition); list.add(dragPosition, map); demoAdapter.notifyDataSetChanged(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } }


【文件预览】:
DragListView-master
----library()
--------proguard-project.txt(781B)
--------.settings()
--------src()
--------.project(810B)
--------.classpath(466B)
--------project.properties(584B)
--------AndroidManifest.xml(261B)
--------libs()
----Sample()
--------res()
--------proguard-project.txt(781B)
--------ic_launcher-web.png(50KB)
--------.settings()
--------src()
--------.project(809B)
--------.classpath(466B)
--------project.properties(631B)
--------AndroidManifest.xml(853B)
--------libs()
----LICENSE(11KB)
----.gitignore(904B)
----README.md(2KB)
----.gitattributes(378B)

网友评论