Android ListView with fast scroll and alphabetical section index

后端 未结 3 1492
感情败类
感情败类 2020-12-05 19:49

How to add testview when touching a letter on right alphabet panel as shown in images? Could you please help me? Below is my code.

In details, I am looking for an e

3条回答
  •  臣服心动
    2020-12-05 20:32

    Hear is one cool example of what you need https://github.com/woozzu/IndexableListView

    IN order to compile the project and get rid of korean text update the StringMatcher class

    package com.woozzu.android.util;
    
    public class StringMatcher {
        public static boolean match(String value, String keyword) {
            if (value == null || keyword == null)
                return false;
            if (keyword.length() > value.length())
                return false;
    
            int i = 0, j = 0;
            do {
                int vi = value.charAt(i);
                int kj = keyword.charAt(j);
                if (isKorean(vi) && isInitialSound(kj)) {
                } else {
                    if (vi == kj) {
                        i++;
                        j++;
                    } else if (j > 0)
                        break;
                    else
                        i++;
                }
            } while (i < value.length() && j < keyword.length());
    
            return (j == keyword.length())? true : false;
        }
    
        private static boolean isKorean(int i) {
            return false;
        }
    
        private static boolean isInitialSound(int i) {
            return false;
        }
    }
    

提交回复
热议问题