小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

Android仿QQ復(fù)制昵稱效果2

 Coder編程 2022-01-15

解決辦法:

PopupList.java的代碼封裝的比較完善,用純java代碼實(shí)現(xiàn)view效果,不需要使用圖片,xml資源文件,引入的話,只需要copy PopupList.java代碼到項(xiàng)目工程中。

剩下的就是調(diào)用了。這里不分析源碼,源碼比較簡單,只講如何使用的。

PopupList popupList = new PopupList(this);
List<String> popupMenuItemList = new ArrayList<>(Arrays.asList("復(fù)制QQ號"));
popupList.bind(tvQQNum, popupMenuItemList, new PopupList.PopupListListener() {
    @Override
    public boolean showPopupList(View adapterView, View contextView, int contextPosition) {
        return true;
    }
 
    @Override
    public void onPopupListClick(View contextView, int contextPosition, int position) {
        ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
        ClipData clipData = ClipData.newPlainText("Label", "10001");
        cm.setPrimaryClip(clipData);
    }
});
PopupList popupList = new PopupList(this);
List<String> popupMenuItemList = new ArrayList<>(Arrays.asList("復(fù)制"));
popupList.bind(tvUserName, popupMenuItemList, new PopupList.PopupListListener() {
    @Override
    public boolean showPopupList(View adapterView, View contextView, int contextPosition) {
        return true;
    }
 
    @Override
    public void onPopupListClick(View contextView, int contextPosition, int position) {
        ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
        ClipData clipData = ClipData.newPlainText("Label", "天天");
        cm.setPrimaryClip(clipData);
    }
});

用法很簡單。PopupList支持單個,也支持?jǐn)?shù)組形式的結(jié)構(gòu),如朋友圈點(diǎn)贊的那種效果等。

參考資料:

https://github.com/shangmingchao/PopupList

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多