課程
/移動開發(fā)
/Android
/Android高級特效-索引
是不是還沒有講完,首先匹配字符串的算法貌似有問題,如:value = abcbde,key = bd;其次,最關鍵的算法getSectionByPoint()我想知道怎么實現(xiàn)~~這個貌似沒大懂,,,
2015-09-13
源自:Android高級特效-索引
正在回答
原理上講完了,只是最后部分代碼沒有說
private?int?getSectionByPoint(float?y)?{ ????if?(mSections?==?null?||?mSections.length?==?0)?{ ????????return?0; ????} ????if?(y?<=?mIndexbarRect.top?+?mIndexbarMargin)?{ ????????return?0; ????} ????if?(y?>=?mIndexbarRect.top?+?mIndexbarRect.height()?-?mIndexbarMargin)?{ ????????return?mSections.length?-?1; ????} ????return?(int)?((y?-?mIndexbarRect.top?-?mIndexbarMargin)?/?((mIndexbarRect.height()?-?2?*?mIndexbarMargin)?/?mSections.length)); }
舉報
APP中的熟面孔,索引列表的實現(xiàn),有效增加了查找的便捷度
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2015-12-24
原理上講完了,只是最后部分代碼沒有說