position
.
36 | */
37 | @Override
38 | public View onCreateFloatView(int position) {
39 | // Guaranteed that this will not be null? I think so. Nope, got
40 | // a NullPointerException once...
41 | View v = mListView.getChildAt(position + mListView.getHeaderViewsCount() - mListView.getFirstVisiblePosition());
42 |
43 | if (v == null) {
44 | return null;
45 | }
46 |
47 | v.setPressed(false);
48 |
49 | // Create a copy of the drawing cache so that it does not get
50 | // recycled by the framework when the list tries to clean up memory
51 | //v.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
52 | v.setDrawingCacheEnabled(true);
53 | mFloatBitmap = Bitmap.createBitmap(v.getDrawingCache());
54 | v.setDrawingCacheEnabled(false);
55 |
56 | if (mImageView == null) {
57 | mImageView = new ImageView(mListView.getContext());
58 | }
59 | mImageView.setBackgroundColor(mFloatBGColor);
60 | mImageView.setPadding(0, 0, 0, 0);
61 | mImageView.setImageBitmap(mFloatBitmap);
62 | mImageView.setLayoutParams(new ViewGroup.LayoutParams(v.getWidth(), v.getHeight()));
63 |
64 | return mImageView;
65 | }
66 |
67 | /**
68 | * This does nothing
69 | */
70 | @Override
71 | public void onDragFloatView(View floatView, Point position, Point touch) {
72 | // do nothing
73 | }
74 |
75 | /**
76 | * Removes the Bitmap from the ImageView created in
77 | * onCreateFloatView() and tells the system to recycle it.
78 | */
79 | @Override
80 | public void onDestroyFloatView(View floatView) {
81 | ((ImageView) floatView).setImageDrawable(null);
82 |
83 | mFloatBitmap.recycle();
84 | mFloatBitmap = null;
85 | }
86 |
87 | }
88 |
89 |
--------------------------------------------------------------------------------
/studioOne/androidOne/src/main/java/com/sd/one/widget/sortlistview/PinyinComparator.java:
--------------------------------------------------------------------------------
1 | package com.sd.one.widget.sortlistview;
2 |
3 | import java.util.Comparator;
4 |
5 | /**
6 | * [A brief description]
7 | *
8 | * @author devin.hu
9 | * @version 1.0
10 | * @date 2014-2-7
11 | *
12 | **/
13 | public class PinyinComparator implements ComparatorThe onItemClicked() method is called whenever a wheel item is clicked 6 | *